ngOfficeUIFabric / ng-officeuifabric

Office UI Fabric (https://github.com/OfficeDev/office-ui-fabric) implementation for Angular
http://ngOfficeUiFabric.com
MIT License
320 stars 67 forks source link

[DatePicker] Year changes unexpectedly after selecting a month #485

Closed jskvoll closed 7 years ago

jskvoll commented 7 years ago

Issue found by my team member.

Reproduces: http://ngofficeuifabric.com/demos/uifDatepicker/

Expected Behavior

Selectiion of a month not reflects on the selected year

Actual Behavior

Selected year changes after selecting a month

Steps to Reproduce Behavior

http://i.imgur.com/8qxpbel.gifv

andrewconnell commented 7 years ago

Unfortunately, this bug is coming from the pickadate.js library which we take a dependency on because that's what Office UI Fabric v2.6.* takes a dependency on... just as I explained in #493. Therefore this bug needs to be addressed in that library as it's not something we can fix in this project.

nightullr commented 7 years ago

Actually, I believe this specific bug is caused by the ngOfficeUIFabric implementation... I'm still working through understanding how the component works with pickadate.js, but the events that handle month and year navigation in the datepicker component are sending the .day (day of the week) picker property while pickadate is expecting the .date (day of the month) picker property to set the new date. I suspect this is the root of the issue, since day of the week values are 0-6 and day of the month values are 1-31. In my testing so far, changing the datepicker component line to .date seems to resolve this issue. I will likely submit a PR for it with details and a demo!