-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Default to medium rather than short dateStyle #813
Conversation
It's the default because that's what |
Not quite, without options the year uses four digits: new Intl.DateTimeFormat('en').format(new Date) // '7/1/2024'
new Intl.DateTimeFormat('en', { dateStyle: 'short' }).format(new Date) // '7/1/24' And it's by no means the only JS default that's available: new Date().toString() // 'Mon Jul 01 2024 16:20:00 GMT+0300 (Eastern European Summer Time)'
new Date().toLocaleString('en') // '7/1/2024, 4:20:00 PM' We should probably determine what defaults make sense for MF2 independently of JS legacies. |
We should:
JS's APIs and ICU's APIs are good influences to look at. FWIW, Java and ICU4J's default is the medium format. Personally... I think we should get skeletons (or their proxy) in and encourage that they always be used (rather than the sometimes-inconsistent enumerations). I don't necessarily disagree with what's being proposed here, but we shouldn't just do things randomly. Note that this will be a normative change and we should act as-if stability rules are almost in place. Do we (or the ES folk) have any feedback on defaulting? |
This PR includes updates to the design doc as well.
I think
For the JS side of things, that carries a precondition of introducing skeletons in Intl.DateTimeFormat, which no-one's even proposed for the spec. |
Actually, not necessarily. Option-bags are effectively verbose skeletons. The thing you're calling out about e.g. That is, instead of choosing which
(we can quibble about which bag of options for each; note that I went with short month rather than an all-numeric as default) |
This is problematic in at least two different ways:
I at least would be much happier with sticking with short dates rather than opening up the can of worms implicitly proposed by the above. The intent with this PR is to make a small change to the date formatting default value. Rethinking the whole approach and ECMA-402 compatibility should be a separate matter. |
The first problem could be addressed by making
402 doesn't define what they mean on purpose because CLDR doesn't either. They do vary by locale. This makes a kind of sense, but it also means that developers and user experience designers can get into trouble (by expecting that the fields will be the same as US English). What's more, as you've already shown, it means that the default format isn't necessarily any of the enumerated values (although it might be).
Perhaps. I think we need to finish off the date/time stuff, because what we have is insufficient for real world users. The canned formats are not what UX designers are looking for in many applications. And you can't get very far without dealing with timezones/floating time values. We don't address either currently. Our defaults should be reasonable for users to sometimes use them. We shouldn't create a ton of work for our implementers, but we shouldn't adopt defaults that are not very useful either (even if 402 has). I agree with you that |
This was discussed briefly in the 2024-07-08 call (which I missed). Adding to the agenda for 2027-07-15 so that we can resolve it. |
In the 2024-07-15 call we agreed to default to medium. Removing agenda+. Adding action-item for @eemeli to update the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I can't remember why/how we ended up with
short
being the default value for the:datetime
dateStyle
andtimeStyle
, and their:time
and:date
equivalents. Given how dates and times tend to be placed within text, I think that whileshort
is a good default for time,long
is better for dates.In a JS en-US environment, we get:
short
medium
long
So the overall default for
:datetime
would bedateStyle=long timeStyle=short
: