mominsamir / smDateTimeRangePicker

Angular Material Date Picker, DateTime Picker, Date Range Picker, Date Time range picker
http://mominsamir.github.io/smDateTimeRangePicker/
MIT License
130 stars 50 forks source link

Return previous day #151

Closed oleg-demkovych closed 7 years ago

oleg-demkovych commented 7 years ago

When i select start day (on date range picker), the selected value decresed by 1, i.e.: 04/06/2017->03/06/2017

oscar09 commented 7 years ago

Please test with latest code. It should be fixed now.

oleg-demkovych commented 7 years ago

I used v.2.0.10, but issue still happened

oleg-demkovych commented 7 years ago

<sm-range-picker-input fname="Date" label="Date" ng-model="transactionsCtrl.defaultData" format="MM/DD/YYYY" flex="100" min-date="01/01/2017" max-date="12/30/2199" divider="-" week-start-day="Monday" on-range-select="transactionsCtrl.applyDateFilter(range)" custom-to-home="'true'">

oleg-demkovych commented 7 years ago

Here is video with issue http://take.ms/7ms04

oscar09 commented 7 years ago

I believe this issue is fixed in the master version. Not sure why the demo page is not working any more. I will bring it up again and you can test your scenario there.

oleg-demkovych commented 7 years ago

hm. I found how to fix this issue: 1604: date = moment(date);

RangePickerCtrl.prototype.startDateSelected = function(date){
    date = moment(date);
    this.startDate = date;
    this.minStartToDate = date;
    this.scope.$emit('range-picker:startDateSelected');
    this.setNextView();

    if (this.endDate && this.endDate.diff(this.startDay, 'ms') < 0) {
        this.endDate = date;
    }
}
oscar09 commented 7 years ago

I just pushed tag 2.0.11 please try with that version.

oleg-demkovych commented 7 years ago

Thanks. Working well