-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First day of the week notation is inconsistent with dart-core's DateTime #138
Comments
I'm not familiar with this code, but it seems like the locale data is automaticallly generated from ICU, and The generated code probably could be changed, but I'm not sure that it should necessarily be true that extension DateTimeFirstDayOfWeek on DateSymbols {
/// Returns the first day of the week as a [DateTime.weekday] value.
int get firstDayOfWeek => FIRSTDAYOFWEEK + 1;
} and then you could compare |
👋 Yes, as I recall, it's weird, but consistent with CLDR does, which is where the data comes from. I feel like this has come up before, and I ended up trying to write an explanatory comment, but in a quick search I don't find either an issue or the comment. But it ended up being a "after several hours of carefully studying the issue this is in fact obviously correct" kind of situation. The issue may have been Google-internal. |
Okay, thank you @alan-knight and @jamesderlin. If there is no way to fix this (or there is nothing to fix), I'd close this issue. |
It seems to me that the
intl
package'sFIRSTDAYOFWEEK
is not consistent with howDateTime
represents weekdays.In the
dart-core
'sDateTime
class, there are constants for the weekdays:DateTime.monday
is 1,DateTime.tuesday
is 2, ..., andDateTime.sunday
is 7. As far as I know, this is in accordance with ISO 8601 on how to represent weekdays: Monday is represented as1
.However, the
intl
packageDateSymbol
class has aFIRSTDAYOFWEEK
property that is currently described as:After taking a look at the implementation of the
intl
packagedate_symbol_data_local
, the source can be found on GitHub, it appears to be that theFIRSTDAYOFWEEK
values do use 0 for Monday (so the documentation is correct, but inconsistent with theDateTime
value).Examples:
intl
package foren_US
says:FIRSTDAYOFWEEK: 6
.hu
, Spaines_ES
, and Germanyde
, the first day of the week is Monday. In the source, it's marked as 0, which according to theintl
docs corresponds to Monday, but if I were to useDateTime
, I would find the issue thatgermanDateSymbol.FIRSTDAYOFWEEK != DateTime.Monday
.The text was updated successfully, but these errors were encountered: