Closed sffc closed 3 months ago
This issue, if put into the proposal, would mean we also have to
Would like to see this as a normative PR in the July TG1 meeting.
If I write
new Intl.Locale("en-u-fw-tue").getWeekInfo()
then I should get that the first day is Tuesday, but it currently ignores the
-u-fw
.
IIRC you actually get Tuesday starting with ICU 73 (ICU-22226), assuming the input locale is passed as-is to ICU. Addressing #30 should help to clarify how Unicode extension tags are handled.
So I will add a new getter
1.4.X get Intl.Locale.prototype.firstDayOfWeek
that will return one of the 7 possible values "sun", "mon", "tue", "wed", "thu", "fri", "sat"
I think this request surface yet another problem in our current spec Currently the return value of Intl.Locale.prototype.getWeekInfo ( ) use integer 1-7 to represent the weekday as specified in https://tc39.es/proposal-intl-locale-info/#sec-week-info-of-locale
in the firstDay field as a single value and in the weekend as an array (usually 2 values)
But since we are now need to add a getter firstDayOfWeek to return string <<"sun", "mon", "tue", "wed", "thu", "fri", "sat">> should we also change the getWeekInfo().firstDay to reutrn one of <<"sun", "mon", "tue", "wed", "thu", "fri", "sat">> and getWeekInfo().weekend to return an arry of string in <<"sun", "mon", "tue", "wed", "thu", "fri", "sat">> instead?
This issue and https://github.com/tc39/proposal-intl-locale-info/pull/70 was presented to TC39 in July 12, 2023 meeting and does NOT reach consensus for the proposed changes.
Here are my understanding of the part which reach consensus: a. No objection of the need to add "fw" to the [[RelevantExtensionKeys]] internal slots in Intl.Locale in order to read "-u-fw-" from the locale identifier. b. No objection of adding the [[FirstDayOfWeek]] to internal slots in Intl.Locale to keep track the information from a. c. No objection that the getWeekInfo().firstDay will depends on the value in the [[FirstDayOfWeek]] to internal slots in Intl.Locale d. No objection to keep the getWeekInfo().firstDay value in the range 1..7 to sync with Temporal. e. No objection of the need to add a option reading step to get the information to [[FirstDayOfWeek]] in addition to the parsed result from a. e. No objection of the property name to be read from the option as "firstDayOfWeek". f. No objection of adding a getter Intl.Locale.prototype.firstDayOfWeek .
But there are disagreement during July 12 TC39 about I. What should be the possible values that Intl.Locale.prototype.firstDayOfWeek could return. II What should be the possible values that the option reading of firstDayOfWeek proper should accept.
I. Intl.Locale.prototype.firstDayOfWeek returns: <<undefined, "mon", "tue", "wed", "thu", "fri", "sat", "sun">>
I. Intl.Locale.prototype.firstDayOfWeek returns: <<undefined, 1, 2, 3, 4, 5, 6, 7>>
I. Intl.Locale.prototype.firstDayOfWeek returns: <<undefined, 1, 2, 3, 4, 5, 6, 7>>
I. Intl.Locale.prototype.firstDayOfWeek returns: <<undefined, 1, 2, 3, 4, 5, 6, 7>>
I. Intl.Locale.prototype.firstDayOfWeek returns: <<undefined, 1, 2, 3, 4, 5, 6, 7>>
Option C and Option E consider the fact that Date.prototype.getDay ( ) return 0, but not 7, for Sunday. See https://tc39.es/ecma262/#sec-date.prototype.getday
Most people after TG2 2023-09-07 meeting unofficially support Option C
This issue is addressed by PR70 after TC39 on 2023-09 which is option C. However, it cause issue in https://github.com/tc39/proposal-intl-locale-info/issues/78 and we now plan to revert from option C
I plan to change the spect to the following: I. Intl.Locale.prototype.firstDayOfWeek returns: <<undefined, "mon", "tue", "wed", "thu", "fri", "sat", "sun">>
Propose fix in https://github.com/tc39/proposal-intl-locale-info/pull/79
I. Intl.Locale.prototype.firstDayOfWeek returns: <<undefined, "mon", "tue", "wed", "thu", "fri", "sat", "sun">>
sorry, this is not right. I need to rework on this. Intl.Locale.prototype.firstDayOfWeek need to return string, but not just that 7 string values.
Related: #30, https://github.com/tc39/ecma402/issues/580
If I write
then I should get that the first day is Tuesday, but it currently ignores the
-u-fw
.