Skip to content

Relative days of the week are not parsed #127

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

Closed
evanjs opened this issue Mar 14, 2025 · 2 comments · Fixed by #128
Closed

Relative days of the week are not parsed #127

evanjs opened this issue Mar 14, 2025 · 2 comments · Fixed by #128

Comments

@evanjs
Copy link

evanjs commented Mar 14, 2025

Problem

Relative days of the week (e.g. "last monday") are not parsed

GNU date seems to handle relative dates without issue.

Tested using coreutils v0.0.30

Example

# last monday
❯ date -d 'last monday'
Mon Mar 10 12:00:00 AM EDT 2025

❯ uutils-date -d 'last monday'
uutils-date: invalid date 'last monday'

# next monday
❯ date -d 'next monday'
Mon Mar 17 12:00:00 AM EDT 2025

❯ uutils-date -d 'next monday'
uutils-date: invalid date 'next monday'

Related PRs

#23 Days of the week are not recognized

@julian-klode
Copy link

Also extends to hours, probably any relative timestamp:

jak@jak-t14-g3 ~/P/D/apt (solver3)> ~/.cargo/bin/coreutils  touch -m -d "now + 1 hour" README.md
touch: Unable to parse date: now + 1 hour

@dan-hipschman
Copy link
Contributor

Also extends to hours, probably any relative timestamp:

jak@jak-t14-g3 ~/P/D/apt (solver3)> ~/.cargo/bin/coreutils  touch -m -d "now + 1 hour" README.md
touch: Unable to parse date: now + 1 hour

This is actually unrelated. It's just a minor issue with how this crate parses numbers:

$ date -d "now + 1 hour"
Mon Apr 21 01:33:19 PM PDT 2025

$ cargo run -q date -d "now + 1 hour"
date: invalid date 'now + 1 hour'

$ cargo run -q date -d "now +1 hour"
Mon Apr 21 13:33:29 PDT 2025

I made a separate PR for it than for the original issue: #129

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 a pull request may close this issue.

3 participants