Subject: bug#57834: Date Command Anomaly

From: Bert Wesarg <[email-masked]>
Date: Fri, 23 Sep 2022 15:03:06 +0200

Dear,

$ TZ=Europe/London date --debug --date="2022/03/27 01:00:00"
date: warning: value 2022 has 4 digits. Assuming YYYY/MM/DD
date: parsed date part: (Y-M-D) 2022-03-27
date: parsed time part: 01:00:00
date: input timezone: TZ="Europe/London" environment value
date: using specified time as starting value: '01:00:00'
date: error: invalid date/time value:
date:     user provided time: '(Y-M-D) 2022-03-27 01:00:00'
date:        normalized time: '(Y-M-D) 2022-03-27 02:00:00'
date:                                             --
date:      possible reasons:
date:        non-existing due to daylight-saving time;
date:        numeric values overflow;
date:        missing timezone
date: invalid date ‘2022/03/27 01:00:00’

Best
Bert

On Thu, Sep 15, 2022 at 5:21 PM Martin Hughes via GNU coreutils Bug
Reports <[email-masked]> wrote:
>
>
> Dear Sir,
> I have stumbled across this anomaly whilst processing a series of dates.
> I have not found any other legal date combination that generates this
> error. Perl time facilities seem to be affected by this too.
>
> mjh@carnaby:~> date --date="2022/03/27 00:00:00"
> Sun 27 Mar 00:00:00 GMT 2022
>
> mjh@carnaby:~> date --date="2022/03/27 01:00:00"
> date: invalid date ‘2022/03/27 01:00:00’
>
> mjh@carnaby:~> date --date="2022/03/27 02:00:00"
> Sun 27 Mar 02:00:00 BST 2022
>
> The version of date is:
> mjh@carnaby:~> date --version
> date (GNU coreutils) 8.29
> Copyright (C) 2017 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <https://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.
>
> The operating system is opensuse leap 15.2:
> Linux version 5.3.18-lp152.106-default (geeko@buildhost) (gcc version
> 7.5.0 (SUSE Linux)) #1 SMP Mon Nov 22 08:38:17 UTC 2021 (52078fe)
>
> Martin Hughes