Subject: RE: bug#53033: date has multiple "first saturday"s?

From: Darryl Okahata <[email-masked]>
Date: Wed, 5 Jan 2022 23:14:43 +0000

From coreutils 9.0 (note the difference between the "second" and "third"
saturdays):

$ src/date --debug -d "first saturday"
date: parsed day part: next/first Sat (day ordinal=1 number=6)
date: input timezone: system default
date: warning: using midnight as starting time: 00:00:00
date: new start date: 'next/first Sat' is '(Y-M-D) 2022-01-08 00:00:00'
date: starting date/time: '(Y-M-D) 2022-01-08 00:00:00'
date: '(Y-M-D) 2022-01-08 00:00:00' = 1641628800 epoch-seconds
date: timezone: system default
date: final: 1641628800.000000000 (epoch-seconds)
date: final: (Y-M-D) 2022-01-08 08:00:00 (UTC)
date: final: (Y-M-D) 2022-01-08 00:00:00 (UTC-08)
src/date: output format: ‘%a %b %e %H:%M:%S %Z %Y’
Sat Jan  8 00:00:00 PST 2022

$ src/date --debug -d "second saturday"
date: parsed relative part: +1 seconds
date: parsed day part: Sat (day ordinal=0 number=6)
date: input timezone: system default
date: warning: using midnight as starting time: 00:00:00
date: new start date: 'Sat' is '(Y-M-D) 2022-01-08 00:00:00'
date: starting date/time: '(Y-M-D) 2022-01-08 00:00:00'
date: '(Y-M-D) 2022-01-08 00:00:00' = 1641628800 epoch-seconds
date: after time adjustment (+0 hours, +0 minutes, +1 seconds, +0 ns),
date:     new time = 1641628801 epoch-seconds
date: timezone: system default
date: final: 1641628801.000000000 (epoch-seconds)
date: final: (Y-M-D) 2022-01-08 08:00:01 (UTC)
date: final: (Y-M-D) 2022-01-08 00:00:01 (UTC-08)
src/date: output format: ‘%a %b %e %H:%M:%S %Z %Y’
Sat Jan  8 00:00:01 PST 2022

$ src/date --debug -d "third saturday"
date: parsed day part: third Sat (day ordinal=3 number=6)
date: input timezone: system default
date: warning: using midnight as starting time: 00:00:00
date: new start date: 'third Sat' is '(Y-M-D) 2022-01-22 00:00:00'
date: starting date/time: '(Y-M-D) 2022-01-22 00:00:00'
date: '(Y-M-D) 2022-01-22 00:00:00' = 1642838400 epoch-seconds
date: timezone: system default
date: final: 1642838400.000000000 (epoch-seconds)
date: final: (Y-M-D) 2022-01-22 08:00:00 (UTC)
date: final: (Y-M-D) 2022-01-22 00:00:00 (UTC-08)
src/date: output format: ‘%a %b %e %H:%M:%S %Z %Y’
Sat Jan 22 00:00:00 PST 2022

  -- Darryl

-----Original Message-----
From: Andreas Schwab <[email-masked]> 
Sent: Wednesday, January 5, 2022 2:10 PM
To: Darryl Okahata via GNU coreutils Bug Reports <[email-masked]>
Cc: [email-masked]; Darryl Okahata <[email-masked]>
Subject: Re: bug#53033: date has multiple "first saturday"s?

On Jan 05 2022, Darryl Okahata via GNU coreutils Bug Reports wrote:

>         $ date -d "first saturday"
>         Sat Jan  8 00:00:00 PST 2022
>
> Unless there is some weird definition of "first Saturday", shouldn't 
> this be the 1st (New Year's Day)?

Try date --debug.

--
Andreas Schwab, [email-masked]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1 "And now for something completely different."