longbill / jquery-date-range-picker

A jQuery plugin that allows user to select a date range
MIT License
1.12k stars 579 forks source link

Error on select default dates, text show UNDEFINED mounth and year #473

Open ferlorca opened 5 years ago

ferlorca commented 5 years ago

I found an error in this plugin when I select by default date the same date that I use as a max date at the moment to configure this plugin.. Example: function configDateRangePickerWithMaxMin(max = null) { return { format: 'DD-MM-YYYY', language: 'es', separator: ' al ', endDate: (max != null) ? moment(max, "DD-MM-YYYY").toDate() : null, monthSelect: true, yearSelect: true, getValue: function () { return $(this).val(); }, } }; var today = moment(new Date).format("DD-MM-YYYY"); //daterange input $("#reportrange-busqueda").dateRangePicker(configDateRangePickerWithMaxMin(today)) $("#reportrange-busqueda").data('dateRangePicker').setDateRange(today , today); I hope this issue help you to improve this great plugin

monovertex commented 4 years ago

Please provide a reproduction through JSFiddle or something similar.