inukshuk / edtf.js

Extended Date Time Format (ISO 8601-2 / EDTF) Parser for JavaScript
BSD 2-Clause "Simplified" License
66 stars 12 forks source link

Invalid upper bound with dates before 1970-01-01 #44

Closed tarjelavik closed 1 year ago

tarjelavik commented 1 year ago

Hi! I notice that if i try to add an interval with an unknown start it fails it the "end" is lower than 1970. Doing "../1960" works but has another meaning.

Looking at the code it seems like there is a missing check for this.lower being null?

https://github.com/inukshuk/edtf.js/blob/36f756fe295d94f9ad5bb8fd84200de5f2cb7b5c/src/interval.js#L93-L94

inukshuk commented 1 year ago

Could you post full examples that fail for you? I understood this to mean that "/1960" fails, but this seems to work fine (see the test cases added in the commit above).

tarjelavik commented 1 year ago

Sry, for the bad issue. I have created a PR now with failing test in first commit and a fix in the second. Unsure if this would have some side effects, but the other test are ok after the fix.

https://github.com/inukshuk/edtf.js/pull/45

inukshuk commented 1 year ago

Landed in 4.4.2.

tarjelavik commented 1 year ago

Thx, for the quick merge :-)!