Promact / md2

Angular2 based Material Design components, directives and services are Accordion, Autocomplete, Collapse, Colorpicker, Datepicker, Dialog(Modal), Menu, Multiselect, Select, Tabs, Tags(Chips), Toast and Tooltip.
http://code.promactinfo.com/md2/
MIT License
379 stars 111 forks source link

[datepicker-BUG] Datepicker auto -1 month when use format properties #276

Open DE-TriNguyen opened 7 years ago

DE-TriNguyen commented 7 years ago

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

  1. Go to : http://code.promactinfo.com/md2/#/datepicker
  2. 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 7 years ago

Workaround :

import { Md2Datepicker } from 'md2'; Md2Datepicker.prototype._handleBlur = function (event) { return; };

and it's working like a charm

DE-Kato commented 7 years ago

@DE-TriNguyen Unfortunately, this approach still makes the "md2-datepicker-input-focused" class remain. I'm also struggling with it... 😢

Mfron-42 commented 6 years ago

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);
}