Skip to content

The keyword ago behaves differently here than in GNU date. #131

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

Open
yuankunzhang opened this issue Apr 22, 2025 · 0 comments
Open

The keyword ago behaves differently here than in GNU date. #131

yuankunzhang opened this issue Apr 22, 2025 · 0 comments

Comments

@yuankunzhang
Copy link
Contributor

Problem

In this implementation, ago may appear only once -- at the end of the entire expression -- and its effect is global, reversing all preceding date‑time displacements as a single group.

GNU date treats ago as a local modifier: it can follow any individual displacement, may be used multiple times in the same expression, and applies only to the displacement that immediately precedes it.

Examples

$ date
Tue Apr 22 10:06:38 PM +08 2025

$ date -d '2 days 3 days ago'
Mon Apr 21 10:07:03 PM +08 2025
$ coreutils date -d '2 days 3 days ago'
Thu Apr 17 22:07:14 UTC 2025

$ date -d '2 days ago 3 days ago'
Thu Apr 17 10:08:33 PM +08 2025
$ coreutils date -d '2 days ago 3 days ago'
date: invalid date '2 days ago 3 days ago'
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.

1 participant