Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe date serialization/possible data corruption #486

Open
stefnotch opened this issue Sep 9, 2022 · 1 comment
Open

Safe date serialization/possible data corruption #486

stefnotch opened this issue Sep 9, 2022 · 1 comment

Comments

@stefnotch
Copy link

stefnotch commented Sep 9, 2022

When saving an object like { a: "0000-00-00T00:00:00" } and subsequently reading it, the string will become a date object. This means that with some data, this library cannot safely round-trip.

if (typeof value == "string" && this.dateRegex.exec(value) != null) {

I recommend doing it correctly, see https://stackoverflow.com/a/73155667/3492994

@Belphemur
Copy link
Owner

That a good idea.

I'm open to MR :)

It would be hard to update the current adapter:
https://github.com/Belphemur/node-json-db/blob/develop/src/adapter/data/JsonAdapter.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants