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

Add support for moment >= 2.25 #1

Merged
merged 2 commits into from
May 11, 2022
Merged

Conversation

jeffmhastings
Copy link

@jeffmhastings jeffmhastings commented May 9, 2022

In moment 2.25.0 they added support for YYYY as a valid ISO_8601 date. This causes waterline-sqlite3 to convert 4 digit strings into Dates, which can cause unintended consequences with the way that waterline-sqlite3 works.

For instance, with a string like '1234', it will be stored in the database as -23225875200000(number of milliseconds before 1970, I believe).

$ node --eval "console.log(new Date('1234').valueOf())"
-23225875200000

This is inconsistent with the way that waterline-sqlite3 works with moment < 2.25, which would not consider '1234' to be a valid date. In order to support these newer version of moment without breaking backwards compatibility (and without introducing much larger changes) we can simply skip parsing the date for strings less than or equal to 4 characters in length.

@jeffmhastings jeffmhastings requested review from a team, iancamp and javangraham and removed request for a team May 9, 2022 16:34
@jeffmhastings jeffmhastings merged commit d22d61e into immuta May 11, 2022
@jeffmhastings jeffmhastings deleted the fix/support-moment-2.25 branch May 11, 2022 18:35
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

Successfully merging this pull request may close these issues.

3 participants