Accepted answer

Firefox isn't liking the way you're asking it to parse the date.

Simply change all instances of this:

new Date(Date.parse(d['month'] + '-01-' + d['year'])));

To this:

new Date(Date.parse(d['month'] + ' 01 ' + d['year'])));

Removing the - should fix it for you.

See the MDN Date.parse() specification for acceptable parameter formats.


I was able to find a solution for the issue surrounding mobile devices. After I turned on debugging for the iphone, I found the invalid dates array my friend was mentioning and rectified this situation by adding a conditional if statement when running in a mobile device taken from this link (What is the best way to detect a mobile device in jQuery?):

if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
 return x(Date.UTC(d['year'], d['year'], 1))
else {
 return x(new Date(d['month'] + ' 01 ' + d['year']))

Turns out parsing dates for mobile devices required a little change in setting it as a date object. This currently helped me get the correct behavior on mobile devices - Date.UTC():

Related Query

More Query from same tag