From 8a52801c282ee59c255fe3a01e038c9b714ecda9 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Thu, 5 Dec 2024 13:32:12 -0800 Subject: [PATCH] Editorial: Avoid hitting nonnull assertion for bestFormat In a94a793 the desired behaviour when formatting Temporal objects was accidentally applied to formatting Date objects. So new Date().toLocaleDateString([], { hour: "numeric" }); would result in bestFormat being null, and according to the type assertion of the Intl.DateTimeFormat [[DateTimeFormat]] internal slot, that is not possible. Checking that _inherit_ = ~relevant~ here ensures the new behaviour is only applied to Temporal objects, and the type assertion is not hit. See: #3049 --- spec/intl.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/intl.html b/spec/intl.html index 9f1f2d648..13ded2a18 100644 --- a/spec/intl.html +++ b/spec/intl.html @@ -865,7 +865,7 @@

1. Set _formatOptions_.[[<_prop_>]] to _value_. 1. Set _needDefaults_ to *false*. 1. If _needDefaults_ is *true*, then - 1. If _anyPresent_ is *true*, return *null*. + 1. If _anyPresent_ is *true* and _inherit_ is ~relevant~, return *null*. 1. For each property name _prop_ of _defaultOptions_, do 1. Set _formatOptions_.[[<_prop_>]] to *"numeric"*. 1. If _defaults_ is ~zoned-date-time~, then