Subject: Re: bug#43828: invalid date converting from UTC, near DST

From: Bob Proulx <[email-masked]>
Date: Thu, 15 Oct 2020 22:30:17 -0600

Martin Fido wrote:
> I seem to have found a bug in the date utility, converting from UTC
> to Sydney time. It returns invalid date for what should be perfectly
> valid:
> 
>     $ TZ='Australia/Sydney' date -d '2020-10-04T02:00:00Z'
>     date: invalid date ‘2020-10-04T02:00:00Z’
> 
>     $ TZ='Australia/Sydney' date -d '2020-10-04T02:59:59Z'
>     date: invalid date ‘2020-10-04T02:59:59Z’

This is more likely to be in the tzdata zoneinfo database rather than
in date itself.  Could you please report what version of tzdata you
have on your system?  Current on my system is tzdata version 2020b-1.

And also this information too.

    $ zdump -v Australia/Sydney | grep 2020
    Australia/Sydney  Sat Apr  4 15:59:59 2020 UT = Sun Apr  5 02:59:59 2020 AEDT isdst=1 gmtoff=39600
    Australia/Sydney  Sat Apr  4 16:00:00 2020 UT = Sun Apr  5 02:00:00 2020 AEST isdst=0 gmtoff=36000
    Australia/Sydney  Sat Oct  3 15:59:59 2020 UT = Sun Oct  4 01:59:59 2020 AEST isdst=0 gmtoff=36000
    Australia/Sydney  Sat Oct  3 16:00:00 2020 UT = Sun Oct  4 03:00:00 2020 AEDT isdst=1 gmtoff=39600

> Note DST in Sydney changed 10 hours earlier:
> 
>     $ TZ='Australia/Sydney' date -d '2020-10-03T15:59:59Z'
>     Sunday 4 October  01:59:59 AEST 2020
> 
>     $ TZ='Australia/Sydney' date -d '2020-10-03T16:00:00Z'
>     Sunday 4 October  03:00:00 AEDT 2020

Yes.  And I think that is suspicious.  Hopefully the zdump information
will show that database is in need of an update and that is the root
of the problem.  I suspect that DST was moved at some point in time.

> I have version 8.25:
> 
>     $ date --version
>     date (GNU coreutils) 8.25

I tried this on 8.13, 8.23, 8.26, and 8.32 and was unable to reproduce
the problem on any of those versions of date.  But I suspect the root
cause is in the tzdata zoneinfo database.

Bob