GNU bug report logs - #6897
date -d '1991-04-14 +1 day' fails

Previous Next

Package: coreutils;

Reported by: 李嘉鹏 <lijpbasin <at> 126.com>

Date: Sun, 22 Aug 2010 19:33:02 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


Message #31 received at 6897 <at> debbugs.gnu.org (full text, mbox):

From: "Voelker, Bernhard" <bernhard.voelker <at> siemens-enterprise.com>
To: Paul Eggert <eggert <at> CS.UCLA.EDU>, Alan Curry <pacman-cu <at> kosh.dhis.org>
Cc: "6897 <at> debbugs.gnu.org" <6897 <at> debbugs.gnu.org>,
	李嘉鹏 <lijpbasin <at> 126.com>
Subject: RE: bug#6897: date -d '1991-04-14 +1 day' fails
Date: Tue, 24 Aug 2010 09:23:15 +0200
On 08/23/2010 18:02, Payk Eggert wrote:

> ... For example:
> $ TZ=Pacific/Kwajalein date -d 1993-08-20
> date: invalid date `1993-08-20'

> There was no time during the day 1993-08-20, because at midnight Kwajalein
> moved the clocks ahead by 24 hours.

BTW: This example looks different here:

  $ TZ=Pacific/Kwajalein date -d 1993-08-20
  Sat Aug 21 00:00:00 MHT 1993

  $ date --version
  date (GNU coreutils) 8.5
  Packaged by Cygwin (8.5-2)
  Copyright (C) 2010 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
  
  Written by David MacKenzie.

Why?

> Aren't dates fun?

Well, imagine such [an ugly but easy] loop thru all days of a year:

  d='1993-01-01'
  while [ "${d%%-*}" = "1993" ]
  do
    echo $d                                   # loop body
    d=$( date -d "$d + 1 day" '+%Y-%m-%d' )   # step to next day
  done

Given that there's no valid time like 12:00 with TZ="Pacific/Kwajalein" for Aug 20th,
do you think this loop should really fail?
With a normal user's perspective, I'd expect `date` to "just do the job"
and find the next day after 1993-08-19 ...

Have a nice day,
Berny

This bug report was last modified 14 years and 275 days ago.

Previous Next


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