On 29/03/2021 16:39, Lars Noodén wrote:
Severity: normal
Package: coreutils
Version: 8.32-4
On March 29, 2021, if a relative date of '-1 month' is passed to 'date',
then the output shows March instead of February.
$ date; date -d '-1 month'; date -d '1 month ago'; date -d 'last month';
Mon 29 Mar 2021 06:35:43 PM EEST
Mon 01 Mar 2021 05:35:43 PM EET
Mon 01 Mar 2021 05:35:43 PM EET
Mon 01 Mar 2021 05:35:43 PM EET
The output shows March when it clearly should show February instead.
This impairs the usefulness of the program a lot on certain days.
This is a commonly reported issue.
I agree the current operation is confusing.
I'm working on a change to make the adjustment relative to the input
resolution.
I.e. operate on a month basis in this case rather than days etc.
The current FAQ (linked below) suggests the workaround of:
date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B.'
cheers,
Pádraig
https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e