tc39 / proposal-intl-locale-info

An API to expose information of locale, such as week data ( first day of a week, weekend start, weekend end), hour cycle, measurement system, commonly used calendar, etc.
MIT License
56 stars 11 forks source link

WeekInfoOfLocale need to convert loc.[[FirstDayOfWeek]] to number before return #82

Closed FrankYFTang closed 1 month ago

FrankYFTang commented 2 months ago

This is reported by @trflynn89 in https://github.com/tc39/proposal-intl-locale-info/pull/79 I copy his report below:

Hey @FrankYFTang - While implementing this, I came across a small issue. I think WeekInfoOfLocale needs to be updated to match the [[FirstDayOfWeek]] changes. [[FirstDayOfWeek]] can now be an arbitrary string, but steps 4-5 of WeekInfoOfLocale state:

4. Let fw be loc.[[FirstDayOfWeek]].
5. If fw is not undefined, then
    a. Set r.[[FirstDay]] to fw.

Where r.[[FirstDay]] is an "Integer value between 1 and 7". So I think there needs to be a step to convert fw from a string to an integer here.

sffc commented 1 month ago

2024-07-18 TG2 notes: https://github.com/tc39/ecma402/blob/main/meetings/notes-2024-07-18.md#weekinfooflocale-need-to-convert-locfirstdayofweek-to-number-before-return