bendavis78 / paper-date-picker

Material design date picker component for polymer
http://bendavis78.github.io/paper-date-picker/
MIT License
225 stars 132 forks source link

Using locales disabled by recent bugfix #149

Closed whenlit closed 7 years ago

whenlit commented 7 years ago

Since 28e505c, paper-calendar.html loads moment-import.html instead of moment-with-locales-import.html, but paper-date-picker.html doesn't.

paper-date-picker.html loads moment-with-locales-import.html before loading paper-calendar.html, which in turn loads moment-import.html. The app ends up with window.moment pointing to the moment object without locales, and the locales cannot be html-imported anymore because they have already been imported.

I think paper-date-picker.html should also import moments-import.html instead of moment-with-locales-import.html. This way, a user can decide for themselves to import the locales after importing the date picker.

EDIT: I see there already is a fix for this. +1!

elrancid commented 7 years ago

I need the locale import, so I wouldn't load moments-import.html and next load moment-with-locales-import.html, because the first moments-import.html would be useless.

I prefer to load only moment-with-locales-import.html, and now I MUST to delete the row 10 in paper-calendar.html in order not to overwrite the moment instance from the "locale's one" to the "without-locale's one":

...
09: <link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html">
10: <!--<link rel="import" href="../moment-element/moment-import.html">-->
11: <link rel="import" href="paper-date-picker-icons.html">
...

The proposed fix means that who wants the locales need to loads moment-with-locales-import.html AFTER all paper-date-picker loads. Why not to load only the "locale version"? It would be a little more heavy, but it will solve all this issues.