When using the moment.js date library to format a date, I encountered an issue on IE where I would get NaN in the output. This problem did not occur on other browsers such as Chrome and Firefox.
var value = "2015-11";
moment(value).format("YYYY-DD-01 00:00")
> "0NaN-NaN-01 00:00"
To resolve this issue, I added the same pattern to the moment constructor as shown below:
> moment(value,"YYYY-DD-01 00:00").format("YYYY-DD-01 00:00")
"2015-11-01 00:00"
Would it be considered good practice to include this pattern in the constructor for all moment objects creation in order to ensure compatibility with IE?