Difference between Date.toJSON() and Date.toISOString()

One convenient difference is that if you have an invalid date, .toJSON() will output null. However, .toISOString()‘s behavior can vary. In firefox this outputs a string "Invalid Date" but in chrome it raises an exception.

Edit: Recent versions of Firefox have fixed the behavior to be the same as chrome (raising exception). However, the difference between .toJSON() and .toISOString() remains. (outputting null vs. raising exception)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)