0

When applying localization to the angular date range picker the date format is incorrect for the calendar heading. The date should be displayed as YYYY, MM but is displayed as MM, YYYY. I'm using moment().format('ll') to display the localized format in the text input but using the date range picker locale.format option doesn't have any affect on the calendar date format.

var dateOptions = {
  locale: {
    format: 'll'
  }
};

enter image description here

neridaj
  • 2,143
  • 9
  • 31
  • 62

2 Answers2

0

Updated daterangepicker.js as follows:

// added new var around line 719

var calMonth = moment([calendar[1][1].year(), calendar[1][1].month()]).format("L");

// line 754

html += '<th colspan="5" class="month">' + calMonth + '</th>'; 
neridaj
  • 2,143
  • 9
  • 31
  • 62
0

modify daterangepicker.js

line 707

var dateHtml = this.locale.monthNames[calendar[1][1].month()] + calendar[1][1].format(" YYYY");

modify it to the format you want.

var dateHtml = calendar[1][1].format("YYYY") + this.locale.monthNames[calendar[1][1].month()];
Kiran Mistry
  • 2,614
  • 3
  • 12
  • 28
Sunwha
  • 1