[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63784: date --date "1 month ago" +%Y-%m does not work as expected on
|
From: |
Jelle de Jong |
|
Subject: |
bug#63784: date --date "1 month ago" +%Y-%m does not work as expected on day 31 |
|
Date: |
Mon, 29 May 2023 13:55:04 +0200 |
|
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 |
Hello everybody,
I been hitting an issue for a while now that date commands return the
wrong month on day 31 of a month and my automations stops working on
correctly on these days.
root@sydney:~# date
Wed Aug 31 22:09:04 CEST 2022
root@sydney:~# date --date "1 month ago" +%Y-%m
2022-07
root@sydney:~# date --date "2 month ago" +%Y-%m
2022-07
root@sydney:~# date --date "3 month ago" +%Y-%m
2022-05
root@sydney:~# date --date "4 month ago" +%Y-%m
2022-05
root@sydney:~# date
Sat Dec 31 19:20:13 CET 2022
root@sydney:~# date --date '1 month ago' +%Y-%m
2022-12
$ date --version
date (GNU coreutils) 8.30
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
I would love to have this fixed if possible.
If I am using the wrong command I would love to be educated as well.
Should I use date --date "$(date +%Y-%m-01) -1 month" +%Y-%m instead...
Kind regards,
Jelle de Jong
- bug#63784: date --date "1 month ago" +%Y-%m does not work as expected on day 31,
Jelle de Jong <=