because your dateString style cannot be recognized by Date() Object. I have tried your code in Chrome, IE and Firefox. it works in Chrome, but not in Firefox and IE. so I recommend you try the method below.
Date() Object accepts four kinds of input.
- new Date();
- new Date(value);
- new Date(dateString);
- new Date(year, month[, day[, hour[, minutes[, seconds[, milliseconds]]]]]);
if you choose dateString, you should enter string like "2015-02-16" or "2015-02-16T11:03:19" (date and time) can be passed and parsed. The UTC time zone is used to interpret arguments in ISO 8601 format that do not contain time zone information (note that ECMAScript ed 6 draft specifies that date time strings without a time zone are to be treated as local, not UTC).
and here is the relevant documention:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date