Skip to content

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

Open
@yuankunzhang

Description

@yuankunzhang

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions