babel icon indicating copy to clipboard operation
babel copied to clipboard

Changed get_week_number() to fix a problem with the locale en_AU

Open RomainBarbason opened this issue 1 year ago • 3 comments

This is my first pull-request ever, so don't hesitate to give me feedback on anything

If my analysis is correct, get_week_number() made it impossible for iso-calendar to show their last week, because the week_number was fixed from 53 to 1, while it should be fixed to 52. That's why the year wasn't updated and the result was "W1 2023", it should be "W52 2023".

Hope this helps !

Fixes #1133

RomainBarbason avatar Nov 05 '24 09:11 RomainBarbason

Thanks for the PR! Do you think you could add some tests for this fix? Somewhere here might be a good place:

https://github.com/python-babel/babel/blob/313277af993cebfbae49d385327fc7f45e32f737/tests/test_dates.py#L715-L720

tomasr8 avatar Nov 06 '24 21:11 tomasr8

Yep, as Tomas said, a test would be very much appreciated - the week numbering logic seems to be pretty finicky all in all...

akx avatar Nov 10 '24 20:11 akx

Hi ! Sorry for the long wait, I had a lot of work these past weeks. I added the tests you suggested. I don't know if the Pull Request has been updated or not

RomainBarbason avatar Nov 18 '24 11:11 RomainBarbason