dateutils icon indicating copy to clipboard operation
dateutils copied to clipboard

'datetest' fails when given default 'date' strings as date arguments

Open BMJ-pdx opened this issue 6 months ago • 1 comments
trafficstars

'datetest' cannot make sense of default 'date' output:

$ datetest "$(date)" --eq "$(date)" dtest: cannot make sense of `Mon May 19 15:58:14 PDT 2025' using the given input formats

BMJ-pdx avatar May 19 '25 23:05 BMJ-pdx

Hi, yes, this is correct. You need to use date -I or date -Iseconds. The default date output is both locale dependent and in local time.

hroptatyr avatar May 20 '25 12:05 hroptatyr