1
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.

Wilson Campusano
  • 616
  • 9
  • 21

1 Answers1

3
var date = new Date();
var month = date.getMonth() + 1; //Months are zero based

This should work for you to get the month.

brso05
  • 13,142
  • 2
  • 21
  • 40