A quick one!
Does this look fine to you?
It looks fine to me. It turns our it's not fine. In order for this code to return you an expected datetime across browsers (in our case Chrome and IE), we should specify either a timezone or a specific offset. Since we didn't particularly care to add a specific offset, we used
Yep, we just slapped a "Z" on there. Apparently, "Z" is a zero-time UTC offset (-00:00).
This happens because Chrome assumes an unspecified date to be a UTC time with a zero-offset, while IE assumes the timezone should be the same timezone of the client machine (in our case, EST, -05:00).
If you wanted to specify your particular locale's offset, you could construct the date this way
Thanks to Moshe Karmel for the advice!
For reasons like this, I tend to use momentjs for basically everything having to do with dates.