-
Notifications
You must be signed in to change notification settings - Fork 107
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 -- Intl.getCalendarInfo() #6
Comments
The first day of the week drastically varies between Saturday, Sunday, or Monday (or even Friday) between different locales: https://github.com/unicode-cldr/cldr-core/blob/master/supplemental/weekData.json#L61. So, it's definitively wrong to assume it's always Monday. On jQuery UI datepicker, this information is pulled from CLDR https://github.com/jquery/jquery-ui/blob/datepicker-globalize-1.x/ui/calendar.js#L187 (which in turn, uses https://github.com/rxaviers/cldrjs/blob/master/src/supplemental/main.js#L22-L25). Having said that, I agree it's useful having this information available for implementations like datepicker. Although, I leave it open for discussion on how this information should be exposed. |
Obviously we don't use such information today as part of the current spec, but we have been talking about exposing more low-level abstract operations and data in issue #5, maybe exposing low level data like this falls into the same bucket. |
It would be also helpful for all calendar UIs. |
Ok, let's find a champion for this feature, I can help with the spec. |
Do we also want |
@zbraniecki can you double check that we have that information in CLDR? |
Yes, CLDR has this information. Another related information that might be useful on calendars implementations is the first day of the year. |
great! |
Note tr35 specifically:
So two concepts: "the weekend" and "first day of week for calendar display". |
Now, the question is where do we want to display it. One idea is to use
and maybe one day:
This stuff we could get from supplemental CLDR data, and might help pushing those options to the top of selection lists for a selected locale. But the basics are already available and I was already planning providing |
I like the idea of |
Having dozens of methods should be fine (equivalent to having dozens of exports in a module). That's probably easy to detect and polyfill. |
@caridy - Does it mean you'd prefer to keep methods like My concern here is how it'll scale. I don't know prior examples of APIs that define new function for each bit of data. |
It is not a matter of scale (this is a finite number of apis), it is the fact that users will probably need one at a time, not a bulk. But I do agree that we should look into precedents for this, maybe a DOM api, certainly I don't know any JS api that provides that kind of granularity. |
Latest version of #46 has ability to do:
|
I suggest we close this issue and continue discussion in issue #46. |
For Gecko internal use, I landed an API mozIntl.getCalendarInfo('en-US') === {
firstDayOfWeek: 1,
minDays: 1,
weekendStart: 7,
weekendEnd: 1,
calendar: "gregory",
locale: "en-US"
}; I'll be happy to transition away from it toward any standard solution we may come up with for ECMA402. |
@zbraniecki To clarify, presumably the string passed in can be a whole locale, with BCP 47 |
yes :) |
API shape bikeshedding:
|
Would it be a getter on the new object created every time? Or a new member with a new object created every time? I don't think |
I guess you're right; even if it wouldn't be a performance killer here, we couldn't expose everything ih CLDR about every locale in What if it were a new instance method on DateTimeFormat instances (which are already a thing that has a calendar based on various options)? This would let you get information about the same calendar that you're formatting dates with, as opposed to needing to pass the locale in a different form that might not match up. |
@littledan I like that better :) |
I intend to work on this issue by proposing https://github.com/FrankYFTang/proposal-intl-locale-info/ |
Same as #205, can we atleast drop "user preferences" label? |
I agree with @ryzokuken this feature request has nothing to do with "USER" preference. |
I dropped the label, but I do actually feel that this is related to user preferences, because a user could in the future override the locale default using the |
@sffc is the |
I was thinking that this one would be the issue to track "fully supporting" the first day of the week, but since Intl Locale Info is proceeding without support for -u-fw, then yes, we should open a new issue. The issue should be generally about adding additional Unicode extension keywords. |
@sffc perfect, I will create one right now. |
PF's DatePicker defaults to Sunday as the start of the week instead of the given locale's convention. There is currently no official JS API which exposes that piece of locale information [1], and `cockpit.language` does not even contain the country in most cases. So add a `timefirmat.firstDayOfWeek()` approximation by language, which at least gets it right for most of our supported languages *except* English-speaking countries in Europe (in particular, en-GB and en-IE). Add missing aria and localization to the timer creation and user account expiration dialogs, so that their month names are properly translated. [1] tc39/ecma402#6
PF's DatePicker defaults to Sunday as the start of the week instead of the given locale's convention. There is currently no official JS API which exposes that piece of locale information [1], and `cockpit.language` does not even contain the country in most cases. So add a `timefirmat.firstDayOfWeek()` approximation by language, which at least gets it right for most of our supported languages *except* English-speaking countries in Europe (in particular, en-GB and en-IE). Add missing aria and localization to the timer creation and user account expiration dialogs, so that their month names are properly translated. [1] tc39/ecma402#6
Hi there, do we have any movements today ? |
In the latest V8, you can do
However, this is not yet stable and is likely to change into a function call; see tc39/proposal-intl-locale-info#62 |
It seems like there's no way with the current specifications to know the first day of the week for a given locale.
I understand ISO 8601 does consider Monday as the first working day: maybe this is the reason. However there are some locales (AFAIK Canada, U.S. and Mexico) where Sunday should be shown as first day of the week - eg in calendars or date pickers. Is there any plan to make available this information?
The text was updated successfully, but these errors were encountered: