On Tue, Jan 30, 2024 at 04:30:31PM -0500, mwilson--- via talk wrote:
> Discovered when I ran my script to run pcal and refresh my next-month
> calendar, and got March.
> 
> 
> mwilson@ningabel:~$ date
> Tue 30 Jan 2024 04:23:27 PM EST
> mwilson@ningabel:~$ date -d'this month' +%m
> 01
> mwilson@ningabel:~$ date -d'next month' +%m
> 03
> mwilson@ningabel:~$ which date
> /usr/bin/date
> mwilson@ningabel:~$ date --version
> date (GNU coreutils) 9.1
> Copyright (C) 2022 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.
> mwilson@ningabel:~$
> 
> 
> Running Debian 12.2.0-14 patched up to last Friday.  I suppose that in a
> couple of days next month really will be March, and the bug will be gone.

Apparently the way 'next month' works is by adding 31 days.

A work around is to do this:

date +"%m" --date="$(date +%Y-%m-15) next month"

So use this year and this month and the 15th of the month then add
31 days.

-- 
Len Sorensen
---
Post to this mailing list [email protected]
Unsubscribe from this mailing list https://gtalug.org/mailman/listinfo/talk

Reply via email to