icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

week_of_month seems to be broken

Open sffc opened this issue 3 years ago • 1 comments

I added a test in week_of as follows:

    // The 1st is a Monday and the week starts on Sundays.
    assert_eq!(
        simple_week_of(IsoWeekday::Sunday, 26, IsoWeekday::Friday),
        4
    );

but it returns week 1 instead of 4.

sffc avatar Aug 26 '22 21:08 sffc

CC @mildgravitas, can you take a look at this?

sffc avatar Sep 08 '22 18:09 sffc

CC @robertbastian -- please triage this.

sffc avatar Dec 22 '22 18:12 sffc

@Manishearth could you take a look?

robertbastian avatar Jan 03 '23 09:01 robertbastian

I don't really understand the week_of code! (I did not write it, nor was I the primary reviewer)

I could but it would take a while.

Manishearth avatar Jan 03 '23 17:01 Manishearth

Having a look.

The bug is that this is wrong

https://github.com/unicode-org/icu4x/blob/d686c87ad094f9750f5cf6e42e2287076e590de9/components/calendar/src/week_of.rs#L323-L324

Manishearth avatar Jan 04 '23 19:01 Manishearth