Skip to content

date: inconsistent input parsing between -s and -d #9679

@enr0n

Description

@enr0n

The date command is inconsistent with how it parses input, e.g. between the -d and -s flags:

nr@seven:~/m/coreutils$ git describe 
0.5.0-6-g6b23e6f32
nr@seven:~/m/coreutils$ ./target/release/coreutils --version
coreutils 0.5.0 (multi-call binary)
nr@seven:~/m/coreutils$ ./target/release/coreutils date -d '-3 days'
Sat Dec 13 12:43:41 EST 2025
nr@seven:~/m/coreutils$ ./target/release/coreutils date -s '-3 days'
error: unexpected argument '-3' found

  tip: to pass '-3' as a value, use '-- -3'

[ ... SNIP USAGE ...] 

Note that GNU coreutils accepts date -s '-3 days', so this also causes compatibility issues.

I think it would be best if all date flags parse this kind of input the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions