bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6897: date -d '1991-04-14 +1 day' fails


From: Voelker, Bernhard
Subject: 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]