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 112 forks source link

Error when selecting a month with 30 days or less when datepicker is of type 'month'. #265

Open PetrisorIustin opened 7 years ago

PetrisorIustin commented 7 years ago

Bug:

I have an date picker input of type 'month'. When I open the dialog and I pick a month with 30 days or less it gives me an error on console 'ERROR TypeError: Cannot read property 'getFullYear' of null' If I select a month with 31 days it works as expected and after that even the months with 30 days or less can be selected.

I also checked on http://code.promactinfo.com/md2/#/datepicker for type 'month' and the bug is also reproducing in your demo.

DE-Kato commented 6 years ago

This problem may be related to #276 . It can be reproduced at v0.0.28.

Mfron-42 commented 6 years ago

Fiexed with ->

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