Search code examples
datetimedatepickertimezoneangular-strap

Angular Strap Datepicker min-date one day off difference


I am using Angular Strap Bs-Datepicker, I assign the min-date and max-date value in html and when try to choose the date from the datepicker, the minimum date given is disabled and it off by one day. I tried momentjs to convert and assign the value then i realised the issue is not with assigning the value and the datepicker takes it wrongly.

here the plunkr

<code> http://plnkr.co/edit/R2qb5HG6ryPzkx2XR9Yn?p=preview </code>

Solution

  • I have impplemented the momentjs and updated the min-date attribute value with below code. It works perfectly as expected

    ngModel.datePickerMinDate = moment().subtract(120, 'days').format('YYYY-MM-DD');