Daterangepicker dates are wrong

184 views Asked by At

I am using this daterangepicker https://www.daterangepicker.com/ but somehow it displays wrong dates. For example: Today it is the Sunday, 22th November 2020, but the daterangepicker says the 22th Novemeber 2020 is a Monday. Example

and here is my configuration:

$('#singledaterange').daterangepicker({
  "locale": {
      "format": "D. MMM YYYY",
      "separator": " - ",
      "applyLabel": "OK",
      "cancelLabel": "Abbrechen",
      "fromLabel": "Von",
      "toLabel": "Bis",
      "weekLabel": "W",
      "daysOfWeek": [
           "Mo",
           "Di",
           "Mi",
           "Do",
           "Fr",
           "Sa",
           "So"
      ],
      "monthNames": [
           "Januar",
           "Februar",
           "März",
           "April",
           "Mai",
           "Juni",
           "Juli",
           "August",
           "September",
           "Oktober",
           "November",
           "Dezember"
      ],
      "firstDay": 0
   },
   "minDate": moment(),
});
1

There are 1 answers

0
Raphael Wirnsberger On

I solved it. It was obviously my fault. By default, Sunday is the first day of the week, so I had to put Sunday first in the daysOfWeek array, not Monday.