atoomic / perl-TimeDate

time & date parsing and formatting perl library
http://search.cpan.org/dist/TimeDate/
1 stars 4 forks source link

`str2time` incorrectly assumes previous year? #46

Open scottchiefbaker opened 1 year ago

scottchiefbaker commented 1 year ago

When a date is provided without a year, it appears that str2time() assumes the current year for some strings, and the previous year for other strings? This behavior should be consistent across all strings without a year, and probably be documented as well.

I don't see any clarification about this in the documentation, so I'm confused what to expect.

str2time("Jan  4 01:04:16"); # Parses as 2023
str2time("Jan  14 01:04:16"); # Parses as 2023
str2time("Jan  24 01:04:16"); # Parses as 2023

str2time("Feb  4 01:04:16"); # Parses as 2022?
str2time("Mar  4 01:04:16"); # Parses as 2022?
str2time("Apr  4 01:04:16"); # Parses as 2022?
str2time("May  4 01:04:16"); # Parses as 2022?