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
To reply to this bug, email your comments to 52525 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#52525
; Package
coreutils
.
(Wed, 15 Dec 2021 21:58:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Mike Marchywka <marchywka <at> hotmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 15 Dec 2021 21:58:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I'm trying to implement the options shown below. I downloaded the coreutils source
for my distro and don't expect a problem compling and implementing it.
However, is there any interest in adding similar functions to the main code?
I would imagine something like,
date --option=four-digits-are-YYYY,invalid-output-blank-line
My immediate concern is getting this to take the input as a year rather than HHMM and
it would be easier to make date more versatile than put logic around it,
$echo 2000 | date +%Y -f-
2021
not sure if anyone else would want that.
Thanks.
Mike Marchywka
306 Charles Cox Drive
Canton, GA 30115
470-758-0799
404-788-1216
________________________________________
From: Mike Marchywka
Sent: Wednesday, December 15, 2021 2:08 PM
To: coordinator <at> translationproject.org
Subject: the ubuntu "date" command info pointed me to you, question on modification
I wanted to add an option to the linux date command to
deal with pure number date stings - allowing for a 4 digit number
to be a year instead of HHMM - which should be easy
for me to do but I wanted to see how it integrates.
Also, I wanted an output option, that I could write, to
send an invalid message to stdout instead of stderr.
How should I proceed?
Thanks.
Mike Marchywka
306 Charles Cox Drive
Canton, GA 30115
470-758-0799
404-788-1216
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#52525
; Package
coreutils
.
(Wed, 15 Dec 2021 22:10:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 52525 <at> debbugs.gnu.org (full text, mbox):
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-
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#52525
; Package
coreutils
.
(Wed, 15 Dec 2021 22:38:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 52525 <at> debbugs.gnu.org (full text, mbox):
On 12/15/21 14:24, Mike Marchywka wrote:
> 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?
There are thousands of possible data conversions and I'm not sure we
want to head down the road of trying to handle them all.
That being said, this particular conversion might be worth the trouble.
However, 'date' uses the same date parser that a lot of other GNU
programs do. Surely if there's a change to be made to date parsing it
should be made there, not just to 'date', so that all the other programs
can use the new functionality.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#52525
; Package
coreutils
.
(Wed, 15 Dec 2021 22:41:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 52525 <at> debbugs.gnu.org (full text, mbox):
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
Severity set to 'wishlist' from 'normal'
Request was from
Paul Eggert <eggert <at> cs.ucla.edu>
to
control <at> debbugs.gnu.org
.
(Fri, 28 Jan 2022 01:59:01 GMT)
Full text and
rfc822 format available.
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.