Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar: Inline-Mode + i18n - Changing the locale does not update the calendar corretcly #16245

Open
cw-tom opened this issue Aug 16, 2024 · 1 comment
Labels
Resolution: Help Wanted Issue or pull request requires extra help and feedback
Milestone

Comments

@cw-tom
Copy link

cw-tom commented Aug 16, 2024

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:
grafik

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:
grafik

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

  1. Create a calendar in inline-mode.
  2. Change the locale / language using ngx-translate and provide a different firstDayOfWeek within the translations.

Expected behavior

The dates within the date-cells of the calendar should match the weekday.

@cw-tom cw-tom added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 16, 2024
@mertsincan mertsincan added Resolution: Help Wanted Issue or pull request requires extra help and feedback and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 4, 2024
@mertsincan mertsincan added this to the Future milestone Dec 4, 2024
Copy link

github-actions bot commented Dec 4, 2024

Due to PrimeNG team's busy roadmap, this issue is available for anyone to work on. Make sure to reference this issue in your pull request. ✨ Thank you for your contribution! ✨

@github-project-automation github-project-automation bot moved this to Review in PrimeNG Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Help Wanted Issue or pull request requires extra help and feedback
Projects
Status: Review
Development

No branches or pull requests

2 participants