You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We will enter CreateDateTimeFormat with required=ANY and defaults=DATE. And since there is no defined dateStyle or timeStyle, we hit this step to create the best format:
a. Let bestFormat be GetDateTimeFormat(formats, formatMatcher, formatOptions, required, defaults, ALL).
At this point, formatOptions will have an era field of "narrow".
When we enter GetDateTimeFormat, we will set requiredOptions to « "weekday", "year", "month", "day", "dayPeriod", "hour", "minute", "second", "fractionalSecondDigits" » because required=ANY.
We will then end up with anyPresent set to true, because formatOptions has an era field.
And we will have needDefaults set to true, because formatOptions does not have any of the fields in requiredOptions.
Thus we hit this step and return null:
17. If anyPresent is true and needDefaults is true, return null.
I don't think bestFormat is supposed to be nullable?
The text was updated successfully, but these errors were encountered:
This invokes CreateDateTimeFormat with required=DATE and defaults=DATE.
So we have requiredOptions set to « "weekday", "year", "month", "day" », and anyPresent is true because hour is present, and needDefaults is true because the required options are all missing. Thus we return null for the best format again.
With the following
Intl.DateTimeFormat
object:We will enter
CreateDateTimeFormat
withrequired=ANY
anddefaults=DATE
. And since there is no defineddateStyle
ortimeStyle
, we hit this step to create the best format:At this point,
formatOptions
will have anera
field of"narrow"
.When we enter
GetDateTimeFormat
, we will setrequiredOptions
to« "weekday", "year", "month", "day", "dayPeriod", "hour", "minute", "second", "fractionalSecondDigits" »
becauserequired=ANY
.We will then end up with
anyPresent
set to true, becauseformatOptions
has anera
field.And we will have
needDefaults
set to true, becauseformatOptions
does not have any of the fields inrequiredOptions
.Thus we hit this step and return null:
I don't think
bestFormat
is supposed to be nullable?The text was updated successfully, but these errors were encountered: