ng2-ui / datetime-picker

Angular2 DateTime Picker
https://ng2-ui.github.io/#/datetime-picker
MIT License
121 stars 62 forks source link

Calling moment.locale(x) does not result in updated Ng2Datetime static variables #150

Closed wouterter closed 7 years ago

wouterter commented 7 years ago

If I change the moment locale dynamically, the change is not reflected in the variables, e.g Ng2Datetime.firstDayOfWeek won't change when I switch locales.

When I switch the locale, I would like to see the calendar update accordingly.

I would expect that these moment.localeData() lookups are done lazily, but I see that they're called on import time. This way, I won't even be able to set an initial locale in my AppModule code, which is evaluated later than the ng2-datetime-picker code.

Would it not be better to use getters for these variables? You can use a setter for manual override, but if this is not used, then use the getter function.

allenhwkim commented 7 years ago

@woutervandergraaf thanks for your suggestion. I agree with you on this matter. Can you make an effort and create a PR for this? or else you need to wait until I have time for this implementation.

wouterter commented 7 years ago

I will have time for this next week. Until then...

allenhwkim commented 7 years ago

@woutervandergraaf this has been implemented

wouterter commented 7 years ago

Wow, I was about to make time for this on Friday, but you beat me to it! Very nice. I'll be your tester then.