Plot not showing in Safari

In the notebook:

At the bottom, I have a function drawCalendar() which returns a Plot drawing the calendar.
in Chrome the result is displayed as expected.

But when I open the page on an Iphone with the Safari browser, this cell:

drawCalendar(new Date(“3-8-2022”), new Date(“4-13-2022”))

is not displaying anything.

Any ideas?

Safari is stricter than Chrome on date parsing, and new Date(“3-8-2022”) returns an Invalid Date.

1 Like

Thanks, I just recall I tripped over it before…

The following Date format seems to works across all browsers:

// “mm/dd/yyyy”
new Date(“10/26/2020”);

Source: Javascript's Date() does not work with IE & Safari - Grow Together By Sharing Knowledge

If you’re going to use the Date constructor to parse dates, I recommend using ISO 8601 YYYY-MM-DD, such as new Date("2022-03-08").

1 Like