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

From: "Alan Curry" <[email-masked]>
Date: Sun, 22 Aug 2010 20:09:55 -0500 (GMT+5)

Bob Proulx writes:
>   date -d '1991-04-14 12:00 +1 day'
> 
> > I'm from china by the way, and the time zone I am in and to which
> > the systems were set is GMT8(or CST, China Standard Time).

Indeed, 

  TZ=Asia/Shanghai date -d '4/14/1991'
  date: invalid date `4/14/1991'
  TZ=Asia/Shanghai date -d '4/14/1991 01:00:00'
  Sun Apr 14 01:00:00 CDT 1991
  TZ=Asia/Shanghai date -d '1/1/1970 GMT + 671558399 sec'
  Sat Apr 13 23:59:59 CST 1991
  TZ=Asia/Shanghai date -d '1/1/1970 GMT + 671558400 sec'
  Sun Apr 14 01:00:00 CDT 1991

According to tzdata, China had DST from 1986 to 1991.

This comment in the source file indicates some doubt about correctness:

# From Paul Eggert (2006-03-22):
# Shanks & Pottenger write that China (except for Hong Kong and Macau)
# has had a single time zone since 1980 May 1, observing summer DST
# from 1986 through 1991; this contradicts Devine's
# note about Time magazine, though apparently _something_ happened in 1986.
# Go with Shanks & Pottenger for now.  I made up names for the other
# pre-1980 time zones.

Maybe someone who can read Chinese could clear it up by finding the original
policy declarations...

> Please review the FAQ for date.
> 
>   http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-work=
> ing-right_002e

There might be less occurrences of this misunderstanding if we could teach
date that -d 4/14/1991 is not actually a request for 4/14/1991 00:00:00, but
"any time that existed during the day 4/14/1991", or perhaps a more specific
"the first second of 4/14/1991".

Has that been considered and rejected already, or is it just waiting for
someone to implement it?