kartik-v / yii2-widgets

Collection of useful widgets for Yii Framework 2.0
http://demos.krajee.com/widgets
Other
558 stars 175 forks source link

DateRangePicker dont works with "Today" date #327

Open nacesprin opened 7 years ago

nacesprin commented 7 years ago

Using DateRangePicker, if the field is previously empty when click on "Today" date nothing appears. However, if there is any date in the input field, the "today" date works fine.

Why?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/39631814-daterangepicker-dont-works-with-today-date?utm_campaign=plugin&utm_content=tracker%2F530581&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F530581&utm_medium=issues&utm_source=github).
FreeWebStyler commented 7 years ago

Same. Find fast solution:

In daterangepicker.js

Replace this:

if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate)){
    this.callback(this.startDate, this.endDate, this.chosenLabel);
}

to this:

this.callback(this.startDate, this.endDate, this.chosenLabel);

May be it bad solution, don't know what consequences can occur, but seems it work!