GNU bug report logs - #52525
wanted to add option to date command to handle pure numeric input in varying ways and output for invalid dates

Previous Next

Package: coreutils;

Reported by: Mike Marchywka <marchywka <at> hotmail.com>

Date: Wed, 15 Dec 2021 21:58:01 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Mike Marchywka <marchywka <at> hotmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>, 52525 <at> debbugs.gnu.org
Subject: bug#52525: wanted to add option to date command to handle pure numeric input in varying ways and output for invalid dates
Date: Wed, 15 Dec 2021 17:24:22 -0500
On Wed, Dec 15, 2021 at 02:09:29PM -0800, Paul Eggert wrote:
> On 12/15/21 12:39, Mike Marchywka wrote:
> > $echo 2000 | date +%Y -f-
> > 2021
> 
> How about this instead? The idea is to avoid
> adding features if they can easily be
> implemented with some other standard utility.
> This way, you can write your shell scripts now
> rather than waiting for a future fix (plus, it
> keeps 'date' simpler).
> 
> echo 2000 | sed 's/$/-07-01/' | date +%Y -f-
> 

That is great until the input format is YYYY-MM-DD :)
The point of using date was to get all the internal
stuff that deals with ambiguous formats and probably
a lot of other people do that too.  
The info documentation does point out how ambiguous
the human readable dates are. I guess 2000 could also
be ms since epoch. I am calling date from c++
and could just ias easily wrap it in another c++ program
to deal with this but thought it was of more general
interest and I did not want to make another kluge.

Generally I agree with your approach but if date is
going to be a swiss army knife for date conversions
it makes some sense to allow user selection of
ambiguity resolution doesn't it? 

Thanks. 




-- 

mike marchywka
306 charles cox
canton GA 30115
USA, Earth 
marchywka <at> hotmail.com
404-788-1216
ORCID: 0000-0001-9237-455X




This bug report was last modified 3 years and 229 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.