Bri Manning

Cross Browser Issues Are Not a Thing of the Past

January 15, 2015

Most cross browser issues people think about are either the newest APIs or rendering issues back in the IE6 days. The newest APIs will always be like that, but at least there are documentation tools like Can I Use.

And the difference in rendering that was around in the bad old days is largely a thing of the past outside of remote situations. They still happen here and there, but they’re not nearly what they were even five years ago.

Today I ran into a new one. One involving different browser support of Date.

The JavaScript Date object is not new. It’s been relatively stable (as far as I know, but there could have been tweaks, updates, and bug fixes along the way). The issue I ran into was this:

In Chrome, this was not an issue:

var d = new Date('12-10-1975');

Yet, in Safari, that raised this error: Error: Invalid Date. Using a “-” as a separator was not allowed in Safari, so I had to do a quick Regex global replace. The new code was:

var d = new Date('12-10-1975'.replace(/-/g, '/'));

Turns out Firefox has a similar problem, but they were all fixed with that simple replace.

Not a big fix, and not a big deal development-wise, but could be (and was) overlooked in haste. Live, human cross-browser testing is still not a thing of the past. I don’t even think integration or unit testing would’ve caught this using PhantomJS, but I could be wrong.