Closed mazdok closed 3 years ago
In case anyone else had same issue - here is a StackOverflow answer which helped me to solve this https://stackoverflow.com/questions/50666556/language-switch-for-angular-material-datepicker-in-lazy-loaded-module.
And StackBlits demo - https://stackblitz.com/edit/angular-6vupnn?file=src%2Fapp%2Fdatepicker%2Fcustom-date-adapter.ts
First thanks a lot for this package. This actually not a bug report but rather asking for advice. I've been struggling with this problem for a couple of days already...
I have a problem when I try to trigger locale change from my singleton service for a lazy-loaded module. All works fine when it's an eagerly loaded component.
In a service I inject DateAdapter and do on a language change:
It works initially but when I want dynamically change a locale then it doesn't work.
Modified example here - https://github.com/mazdok/angular_datepicker_dayjs_adapter_example/tree/master/projects/example-material-dayjs-adapter.
A stackblitz example (not mine but same problem) - https://stackblitz.com/edit/angular-4cu4cb?file=src%2Fapp%2Fdatepicker%2Fcustom-date-adapter.ts