-
-
Notifications
You must be signed in to change notification settings - Fork 35
Include :date, :datetime, and :time with minimal options #1083
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
base: main
Are you sure you want to change the base?
Conversation
I'm okay with this, although we should have a discussion with the broader group on the option naming bikeshed. |
@@ -187,19 +136,27 @@ All other _operand_ values produce a _Bad Operand_ error. | |||
|
|||
##### Options |
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.
should we consider 12/24 time switches in this iteration? Currently we have whatever the locale defaults to, but some systems allow overrides. I realize that this is the minimal stopgap while we ponder the whole of date/time formatting...
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.
If that is conveyed via the locale extension (a common tactic), then we don't need any override at the translator level.
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.
That's in the Date and Time Override Options already, as hour12
.
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.
@macchiati suggested:
If that is conveyed via the locale extension (a common tactic), then we don't need any override at the translator level.
I don't think that's a good idea. Yes, there is a locale extension. But in a message, the message author should have the ability to specify the appearance or to wire it up to a local variable. The locale override trick would require users to decorate the locale externally.
@eemeli noted:
That's in the Date and Time Override Options already, as hour12.
You're right. My bad for overlooking it.
See #1082 for some of the discussion leading to this proposal.
This is an alternative to #1077, where instead of
dateStyle
andtimeStyle
we start with the following options::datetime
dateFields
dateLength
timePrecision
timeZoneStyle
:date
fields
length
:time
precision
timeZoneStyle
With these, we are able to represent each of the style option combinations rather succinctly:
:date style=short
:date length=short
:date style=medium
:date length=medium
:date style=long
:date length=long
:date style=full
:date fields=year-month-day-weekday length=long
:time style=short
:time precision=minute
:time style=medium
:time precision=second
:time style=long
:time precision=second timeZoneStyle=short
:time style=full
:time precision=second timeZoneStyle=long
:datetime dateStyle=short timeStyle=medium
:datetime dateLength=short timePrecision=second
For the most part,
dateStyle
maps todateLength
(anddateFields
to bring in the weekday), whiletimeStyle
maps totimePrecision
andtimeZoneStyle
.This approach allows for the same locale-specific optionality as is currently in CLDR data, with e.g.
ps
andth
including the era with the year, and many locales defaulting to including a dayperiod (am/pm) indicator in the time.The expectation here is that the options being provided here are sufficiently easy to use and understand without any external reference that we won't need to later introduce
dateStyle
andtimeStyle
, while providing a sufficient foundation for filling in the remaining details.This is not intended to be a complete solution for datetime formatting, but a step towards that. If we accept this, we will need to subsequently and separately consider additional option values like
timePrecision=minuteOptional
ordateFields=year-month
, as well as additional options likeyearStyle
orfractionalSecondDigits
, or evendateStyle
andtimeStyle
. They've all been left out of here to keep this as small as possible, while providing a cohesive whole for many date/time formatting needs.