Closed stevetweeddale closed 8 years ago
Well spotted!
I have to admit that I have not implemented min/max next/prev for masked dates yet -- I have some code in the parser which makes sure things like 2000-9X
or 2000-02-3X
will be rejected but that does not account for leap years yet. Ideally, we would use the same logic for parsing and computing min/max of masked dates.
@stevetweeddale @darthsteven I finally implemented next/max for L1/L2 unspecified dates. It would be much appreciated if you take a look at some of the test cases -- particularly L2 unspecified can be confusing so I hoping that our expectations are the same.
I pushed this as 2.0.0 because we also renamed until()
to through()
and reintroduced until()
with slightly different semantics. See #4
As far as I understand it, the maximum possible extent of
20XX
would be the last second of the year 2099. However it's parse as if it has year precision, sonext()
gives the year 2001, and.max
gives you the year 2001 - 1 millisecond.Looking at the code, I think this would need a bit of a refactor, with the introduction of a secondary notion of precision. Whereas currently it just knows "how many date parts we have provided" it would need to know which the most precise digit before any unknown ones is. So in this case,
20XX
feels like it ought to be treated as a century instead of a year, whilst201X
would be a decade.