js-temporal/temporal-polyfill

Misleading ZonedDateTime.toString error message

akselinurmio opened this issue · 0 comments

In ZonedDateTime.toString calls there is following inconsistency in error messages concerning the smallestUnit option: first, if the given unit is invalid (e.g. an empty string) the error message states that "hour" would be among accepted units. However, "hour" is not accepted value here, so if ZonedDateTime.toString is called with options object { smallestUnit: "hour" }, the error message tells me that the smallestUnit must be a time unit other than "hour".

Screenshot 2024-03-04 at 14 09 19