As proposed on Dec. 8, here is the way Intl.DateTimeFormat handles eraDisplay at contruction time.
As Intl.DateTimeFormat is constructed, a resolved eraDisplay field is evaluated.
value is set to "never" or "always" if it was specified so.
else, including if no eraDisplay was passed, value is set to "auto".
except if value was set to "never", era option is set to "short" if it was undefined.
finally, if "auto" and if the year option is undefined, value is set to "never".
In other words:
auto feature shall work most of the time, without changing user's code.
If [[year]] is not to be displayed, by default [[era]] will not be displayed even if era was specified to some value.
Please note that, as of today (and I'm not sure this is in line with the original intention), if the only asked option is era, all date parts are displayed. With the proposed option, setting era only would result in having all date fields except era !
I thought that only if all date-time option fields were undefined the daymonthyear combination was assumed. (see e.g. in MDN As of today, it is not possible to display the era alone. Something remains to be done here ("Best fit" resolving option ?).
That said, only very demanding users having rather special requirements (displaying era and other part of the date, except year) would have to change their code.
As proposed on Dec. 8, here is the way
Intl.DateTimeFormat
handles eraDisplay at contruction time.Intl.DateTimeFormat
is constructed, a resolvederaDisplay
field is evaluated.eraDisplay
was passed, value is set to "auto".era
option is set to "short" if it wasundefined
.year
option isundefined
, value is set to "never".In other words:
auto
feature shall work most of the time, without changing user's code.era
was specified to some value.Please note that, as of today (and I'm not sure this is in line with the original intention), if the only asked option is
era
, all date parts are displayed. With the proposed option, settingera
only would result in having all date fields except era !I thought that only if all date-time option fields were
undefined
theday
month
year
combination was assumed. (see e.g. in MDN As of today, it is not possible to display theera
alone. Something remains to be done here ("Best fit" resolving option ?).That said, only very demanding users having rather special requirements (displaying era and other part of the date, except year) would have to change their code.