[datepicker-BUG] Datepicker auto -1 month when use format properties
Opened this issue · 3 comments
DE-TriNguyen commented
Bug, feature request, or proposal:
BUG : Datepicker auto -1 month when use format properties
What is the expected behavior?
Datepicker don't auto -1 month when use format properties
What is the current behavior?
BUG : Datepicker auto -1 month when use format properties
What are the steps to reproduce?
Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: http://plnkr.co/edit/rQmUz8WYRh5Vz4gwY8E4?p=info
- Go to : http://code.promactinfo.com/md2/#/datepicker
- Choose
- Picker Type : Month
- Source format : Poland
- Stick Open on focus
- Bug show up ! it's auto -1 value of month when Datepicker show up
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, MD2, OS, browsers are affected?
Angular 2, Chrome
Is there anything else we should know?
I found ur Md2Datepicker.prototype._handleBlur() make this happen
DE-TriNguyen commented
Workaround :
import { Md2Datepicker } from 'md2';
Md2Datepicker.prototype._handleBlur = function (event) {
return;
};
and it's working like a charm
DE-Kato commented
@DE-TriNguyen
Unfortunately, this approach still makes the "md2-datepicker-input-focused" class remain.
I'm also struggling with it... 😢
Mfron-42 commented
i suggest you ->
(DateUtil.prototype as any).createDate = (year, month, date, hours, minutes, seconds) => {
let ret = new Date(year, month, date, hours, minutes, seconds);
return ret.getMonth() == month ? ret : new Date(year, month + 1, 0, hours, minutes, seconds);
}