-
Notifications
You must be signed in to change notification settings - Fork 2
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
Handle dates like "2001" and "2001-10" better #3
Comments
Looks like Date::Manip has some tools that are helpful in solving this problem correctly. It appears to be only available under DM6, but that's good enough for me. We can detect which fields were given and which were implied during the parsing of the date. We can then use that to determine what the range should be. See: |
Or maybe it's completely useless. It seems to return that all fields are complete even when I just give it a year. I'm investigating whether I'm just doing it wrong or if there's a bug in the version Date::Manip I'm using. |
My general inclination is to avoid relying on Date::Manip as much as possible, except as the final fallback method. Not sure if that's for legitimate reasons or just NIH. |
Yes, but if we fall back to it, it would be nice to do the right thing. Based on my experience here, the "complete" method does not act like the documentation says. I'm probably going to abandon the effort. Speaking of NIH, ever heard of DateTime::Format::Natural? |
Merge in GITHUB/date-rangeparser-en from SM-4835 to master * commit '10fa1a12a43e17d3c3e36b6292139b9f89230268': Carve around Date::Manip bug regarding the complete fields provided SM-4835 Move last or past weekday logic to the top and deal with times as we always do SM-4835 Add deprecation warning when DM5 is being used SM-4835 Add pluralization to weekdays test SM-4835 Refrain from re-scoping incomplete arrayref SM-4835 Add support for last or past NUMBER weekdays ago with times SM-4835 Fix indentation in POD SM-4835 Add support for both 'inf' and 'infinity' DateTime objects
If you enter a partial date like the above, it will sort of work, but it does so by falling back to Date::Manip. When that happens, it assumes you mean only a single day.
Thus, "2001" becomes:
and "2001-10" becomes:
These dates ought to be handled more naturally.
The text was updated successfully, but these errors were encountered: