Closed jooseplall closed 2 years ago
Any updates? faced with the same issue
Trying to change the locale during runtime results in the error below.
How do I install these locals in general?
vendor.js:80753 ERROR Error: Missing locale data for the locale "ja-JP".
at findLocaleData (VM39 vendor.js:98789)
at getLocaleFirstDayOfWeek (VM39 vendor.js:124213)
at new OwlMonthViewComponent (VM57 pages-tasks-add-add-module.js:17378)
at NodeInjectorFactory.OwlMonthViewComponent_Factory [as factory] (VM57 pages-tasks-add-add-module.js:17753)
at getNodeInjectable (VM39 vendor.js:80585)
at instantiateAllDirectives (VM39 vendor.js:84503)
at createDirectivesInstances (VM39 vendor.js:83877)
at Module.ɵɵelementStart (VM39 vendor.js:91201)
at OwlCalendarComponent_owl_date_time_month_view_18_Template (VM57 pages-tasks-add-add-module.js:13442)
at executeTemplate (VM39 vendor.js:83850)
According to Angular's specification ja-JP is not a default name for the japanese locale, for that you should use it as 'ja'.
For a full list of supported locales:
Closing
Per docs I can see that it is possible to change the locale of the datepicker at runtime:
constructor(dateTimeAdapter: DateTimeAdapter<any>) { dateAdapter.setLocale('ja-JP'); // change locale to Japanese }
I'm trying to use the datepicker in cooperation with ngx-translate. I have set up a language change subscription which would then set the locale of the selected language:
this.langSub = this._T.onLangChange.subscribe((lang: LangChangeEvent) => { this.dateTimeAdapter.setLocale(lang.lang); });
After the setLocale I can see, that the locale of dateTimeAdapter instance is changed, but the
owlDateTimeLocale
is still unchanged and the datepicker is shown in the locale ofowlDateTimeLocale
DateTimeAdapter instance after changing the locale to 'et'