houseabsolute / DateTime-Locale

Localization support for DateTime.pm
https://metacpan.org/release/DateTime-Locale/
Other
3 stars 12 forks source link

Issue with date locale in september #38

Closed steveyj79 closed 1 year ago

steveyj79 commented 1 year ago

In the latest patch you have made a tweak where when you pass in month sep it now breaks the return, as the expected format is now sept, this causes issues going forwards as all the months expect a 3 letter abbrievation so jan,feb, mar which makes it very inconsistant when it comes to september and in the code you will have to change the date passed into be sept instead of sep in this instance

my $parser = DateTime::Format::Strptime->new( pattern => ('%Y-%m-%d %H:%M:%S'), locale => 'en_GB', time_zone => '-0000', );

using the above code causes the problem as datetime::format:strptime uses datetime::locale

autarch commented 1 year ago

I'm not totally following. Can you provide a complete code example along with the expected output?

steveyj79 commented 1 year ago
my $parser = DateTime::Format::Strptime->new(
    pattern   => (defined $convert_from ? $convert_from: '%Y-%m-%d %H:%M:%S'),
    locale    => 'en_GB',
    time_zone => '-0000',
);

my $dt = $parser->parse_datetime("2023-sep-07 23:10:52");

debug Dumper($dt);

in version 1.28 this works fine, but due to the change in the last set of fixes this now breaks as it's now expecting '2023-sept- 23:10:52' 

but if you pass in the same for any other month it allows for a 3 letter month abbrievation except for september which expects 4, this was also raised in the following issue here

https://github.com/houseabsolute/DateTime-Locale/issues/29

which means for every month bar september you can pass in a 3 month abbrievation but 4 september it needs to be edge cased to 4 as it doesn't like sep but expects sept

autarch commented 1 year ago

The data for this module comes from the CLDR project. Really, all this module does is provide an API for accessing that data. That data can and will change over time. If you think there's a bug in the data you can report it to the CLDR project.

But it sounds to me like this isn't a bug, just a normal change.

steveyj79 commented 1 year ago

i mean it's pretty inconsistant, it's returning 3 month abbrievation for all months except september, which means any formatting anyone does has to now be handled to match, i'll look at the CLKDR project and raise an issue there

autarch commented 1 year ago

Yeah, I'm not sure why the CLDR project changed this. Anyway, I'm going to close this issue since there's nothing to be done for this code.