Calendar: Inline-Mode + i18n - Changing the locale does not update the calendar corretcly #16245
Labels
Resolution: Help Wanted
Issue or pull request requires extra help and feedback
Milestone
Describe the bug
Given:
Calendar-Component in inline mode:
<p-calendar [inline]="true"/>
A service to change the language / locale within the running app by using ngx-translate:
this.translateService.use(locale);
this.translateService.get('primeng').subscribe((res) => { this.config.setTranslation(res); });
Before changing the locale
According to the translation, we have:
firstDayOfWeek = 0
The calendar is as follows:
Problem after changing the locale:
According to the translation we have the following after changing the locale to german:
firstDayOfWeek = 1
The day-labels are correctly translated. However, the the date-cells of the calendar do not fit to the weekday. As shown within the screenshot, August 16th should not be a Saturday:
Current workaround:
Invoke updateUI() within the calendar when changing the locale:
this.primeNgConfig.translationObserver.subscribe(() => { this.calendar?.updateUI(); })
Environment
Windows 10, Firefox, ng serve
Reproducer
No response
Angular version
18.1.4
PrimeNG version
17.18.8
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
20.16.0
Browser(s)
Firefox
Steps to reproduce the behavior
Expected behavior
The dates within the date-cells of the calendar should match the weekday.
The text was updated successfully, but these errors were encountered: