coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

date: day of month is incorrect for some months

Open cakebaker opened this issue 8 months ago • 6 comments

I noticed that day of month is incorrect for some months:

$ for month in {01..12}; do cargo run -q date -d "1999-$month-01" +%d; done
31
31
28
01
01
01
01
01
01
01
31
30

cakebaker avatar Aug 03 '25 14:08 cakebaker

Hi @cakebaker it's working fine, am i missing something?

for month in {01..12}; do cargo run -q date -d "1999-$month-01" +%d; done
01
01
01
01
01
01
01
01
01
01
01
01

btw, can i pick TODOs form date ?

Agent-Hellboy avatar Aug 04 '25 05:08 Agent-Hellboy

@Agent-Hellboy what system do you run? I can reproduce on a Debian:

for month in {01..12}; do cargo run -q date -d "1999-$month-01" +%d; done
31
31
28
01
01
01
01
01
01
01
31
30

sylvestre avatar Aug 04 '25 06:08 sylvestre

btw, can i pick TODOs form date ?

Sure, please note that some of the functionality is in https://github.com/uutils/parse_datetime

cakebaker avatar Aug 04 '25 06:08 cakebaker

I haven't looked into the issue. @Agent-Hellboy if you want to take this one, pay attention to the timezone handling during date time formatting.

yuankunzhang avatar Aug 04 '25 11:08 yuankunzhang

I haven't looked into the issue. @Agent-Hellboy if you want to take this one, pay attention to the timezone handling during date time formatting.

okay, should i create a new feature-flag named jiff inside the https://github.com/uutils/parse_datetime for all APIs used within the uu_date? and yes i will pay attention to timezone handling.

Agent-Hellboy avatar Aug 05 '25 10:08 Agent-Hellboy

@Agent-Hellboy what system do you run? I can reproduce on a Debian:

ohh, I am on ubnutu only. is rustc 1.89.0-nightly (4d051fb30 2025-05-18) affecting in any way , recommend one is 1.85`

Agent-Hellboy avatar Aug 05 '25 10:08 Agent-Hellboy

This issue is due to faulty handling of DST, so @Agent-Hellboy won't see the issue since there is no DST in India.

The issue is fixed by using the master branch of parse_datetime which uses jiff instead of chrono.

Banzobotic avatar Sep 20 '25 14:09 Banzobotic

Closing this issue, it has been fixed in the meantime.

cakebaker avatar Oct 27 '25 09:10 cakebaker