Reputation: 616
alert(parseInt(new Date().toLocaleString('es', {month:'numeric'})));
This code always return 'NaN' on IE
why is this?
how can i solved only using vanilla javascript.
Upvotes: 1
Views: 1047
Reputation: 13232
var date = new Date();
var month = date.getMonth() + 1; //Months are zero based
This should work for you to get the month.
Upvotes: 3