unicef-polymer / etools-datepicker

Apache License 2.0
1 stars 1 forks source link

Year picker sometimes defaults to earliest year instead of current year #5

Open itsjustbrian opened 7 years ago

itsjustbrian commented 7 years ago

Could be a paper-datepicker problem not an etools-datepicker problem, but definitely needs fix. Very annoying for UX

adi130987 commented 7 years ago

I noticed and solve this issue yesterday when I made the changes for clear date button. Now if you you do not set a default date for the date picker or the date object you used to init the date is null or undefined or 'Invalid Date' it will default current day. I made a test again and it's not reproducing anymore. If it does please provide a test case.

itsjustbrian commented 7 years ago

I should have been more clear with this issue. This refers specifically to the year selector within the date-picker. You can see in the screenshot, it defaults to the current date, but clicking on the year picker takes you to the first year / the top of the scroll window.

image

However, one subsequent switch after that (from year -> to date -> back to year) produces the expected behavior like this:

image

adi130987 commented 7 years ago

You're right. I will try to fix it asap.

gpg90 commented 7 years ago

+1 We've also noticed this problem.

It looks like the problem comes not from etools-datepicker directly, but happens in paper-year-list element inside paper-date-picker. It uses iron-list to render elements.

When the "centerSelected" method is called for the first time, the template might be not rendered yet. That could be the reason why the method doesn't work as it should — and year is not placed to the center.

gpg90 commented 7 years ago

We've opened a new issue in paper-date-picker: https://github.com/bendavis78/paper-date-picker/issues/187

I wouldn't expect a quick fix, although. The activity on the issues in this repo is really low recently.

adi130987 commented 7 years ago

To be revised after paper-date-picker issue is fixed. @pitsevich your changes have been merged, new v1.0.13 available. Thanks.