Skip to content

Wrong year for "month day" input #925

Description

@pgtan
~_ print ${.sh.version}      
Version JM 93u+m/1.1.0-alpha+0f6866b6/MOD 2025-06-22
~_ printf '%(%Y)T\n' "Dec 20"
2026
~_ printf '%(%Y)T\n' "Jan 20"
2026
~_ printf '%(%Y)T\n' "Jan"   
2025
~_ date -d "Dec 20" +%Y
2026
~_ date -d "Dec" +%Y   
2025
~_ whence -a date
date is a shell builtin
date is /usr/bin/date

"Month day" input gives next year, not current. Same error also on AIX:

~> print -f '%(%Y)T\n' "Jan 20"
2026
~> print ${.sh.version}
Version JM 93u+m/1.1.0-alpha 2025-06-22
~> uname
AIX

Bug appears also in Version JM 93u+m/1.0.10 2024-08-01

Workaround is to use "first":

~_ print -f '%(%Y)T\n' "first Dec 20"
2025
~_ date -d "first Dec 20" +%Y        
2025

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions