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

Funny parsing results #84

Open
xeruf opened this issue Aug 15, 2024 · 5 comments
Open

Funny parsing results #84

xeruf opened this issue Aug 15, 2024 · 5 comments

Comments

@xeruf
Copy link

xeruf commented Aug 15, 2024

Wrote a small helper to compare to chrono-english.
Apart from #23 and #83, I found some other small issues:

  • year ago produces a one-day offset, presumably because of leap years not being accounted for
  • today, while being consistent in both tools, I would expect to refer to the day start rather than the current time
  • -1h1m should be 61 minutes ago, the preceding minus shall negate the whole expression. It should understand -1h +1m for 59 minutes ago.

image

@xeruf
Copy link
Author

xeruf commented Aug 15, 2024

@conradludgate might also be interesting for your fork https://github.com/conradludgate/interim, which will be my preferred parser with fallback to this one, because each handles some relative times better:

  • unlike the others, parse_datetime can handle plain expressions like week, fortnight, day and stacked relative times such as -1h1m, and handle a + prefix as well as last and next
  • I see no relevant differences in what interim and chrono-english understand - they understand shorthands for day(d) and year(y) unlike parse_datetime, as well as calculating month and year offsets more accurately
  • none of these libraries can handle in X expressions (in 1 hour should be equivalent to +1h) as well as DATE at TIME
  • all libraries handle -X and X ago for day, hour, minute, second

image

image

Irrelevant sidenote: Only chrono-english understands 1se and 1M.

@xeruf
Copy link
Author

xeruf commented Aug 15, 2024

with years business gets funny:
image

@conradludgate
Copy link

For interim, I intended to keep all the quirks of chrono-english for compatibility, but with less panics. I'll admit I haven't given too much thought to the actual cases. I'm open to adding new features if desired

@xeruf
Copy link
Author

xeruf commented Aug 15, 2024

@conradludgate that would be great, if you could add these I could fully rely on interim: conradludgate/interim#7

@sylvestre
Copy link
Contributor

sylvestre commented Sep 5, 2024

@xeruf you could please replace your screenshots by text?
They are terrible for search, reproducibility and accessibility

@uutils uutils deleted a comment from conradludgate Sep 5, 2024
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

3 participants