Subject: Re: bug#38003: date --date=-1month gives same month today

From: Steven Hilton <[email-masked]>
Date: Thu, 31 Oct 2019 17:25:53 +0100

There will be a discontinuity as long as the months are different lengths.

In the current implementation there will be only one discontinuity per
month; the 1st of the month always goes back to the 1st of the preceding
month. The overlap into the next month continues linearly until "now" is
the 1st of the month.

If I understand correctly, you would prefer that on March 29th, 30th, and
31st, this command would return the same date (except on leap years)?
$ date --date=-1month +"%m-%d"
02-28
This would introduce one to three discontinuities per month, but the
calculated month difference always the preceding month.

On Thu, Oct 31, 2019 at 3:46 PM Ilja Honkonen <[email-masked]> wrote:

> Hello
> Please CC me as I'm not on this list. Running date (GNU coreutils) 8.26
> on fedora 30 today (date --utc  -I: 2019-10-31) with --date=-1month gives
> the same month which doesn't make sense:
> $ date --utc -I --date=-1month
> 2019-10-01
> I assume using --date=-31day also wouldn't work if run e.g. in beginning
> of march so this looks like a bug. Same happens also without --utc and
> -I. Thanks
> Ilja
>
>
>
>