JavaScriptCore Date Constructor Works Differently than V8

Date objects should be able to be constructed with strings formatted as YYYY-MM-DD .

On Chrome-based browsers, both of the following are valid:

new Date("2022-06-01")
new Date("2022-6-01")

although the second one does not strictly follow the format. However, it is extremely convenient to work with since you do not have to check for the string length and determine whether to add a 0 in the beginning.

Yet, on my Safari browser, the code:

new Date("2022-6-01")

returns a date object of an invalid date. This is simple to fix, yet it poses an inconvenience during development. Is there any way to let Apple improve its JavaScript engine?

Replies

Is there any way to let Apple improve its JavaScript engine?

Your best option here is to file a report using Feedback Assistant. Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"