Skip to content

Commit

Permalink
Fixed #10013 - firstDayOfWeek is broken in 11.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed Mar 23, 2021
1 parent c4d86dd commit 27db0a4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {RippleModule} from 'primeng/ripple';
import {DomHandler, ConnectedOverlayScrollHandler} from 'primeng/dom';
import {SharedModule,PrimeTemplate,PrimeNGConfig,TranslationKeys} from 'primeng/api';
import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';
import {Subscription} from 'rxjs';

export const CALENDAR_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
Expand Down Expand Up @@ -73,7 +74,7 @@ export interface LocaleSettings {
<th *ngIf="showWeek" class="p-datepicker-weekheader p-disabled">
<span>{{getTranslation('weekHeader')}}</span>
</th>
<th scope="col" *ngFor="let weekDay of getTranslation('dayNamesMin');let begin = first; let end = last">
<th scope="col" *ngFor="let weekDay of weekDays;let begin = first; let end = last">
<span>{{weekDay}}</span>
</th>
</tr>
Expand Down Expand Up @@ -434,6 +435,8 @@ export class Calendar implements OnInit,OnDestroy,ControlValueAccessor {

initialized: boolean;

translationSubscription: Subscription;

_locale: LocaleSettings;

@Input() get defaultDate(): Date {
Expand All @@ -454,7 +457,6 @@ export class Calendar implements OnInit,OnDestroy,ControlValueAccessor {

_defaultDate: Date;


@Input() get minDate(): Date {
return this._minDate;
}
Expand Down Expand Up @@ -558,6 +560,10 @@ export class Calendar implements OnInit,OnDestroy,ControlValueAccessor {
this.createMonthPickerValues();
}

this.translationSubscription = this.config.translationObserver.subscribe(() => {
this.createWeekDays();
});

this.initialized = true;
}

Expand Down Expand Up @@ -2579,6 +2585,10 @@ export class Calendar implements OnInit,OnDestroy,ControlValueAccessor {
this.scrollHandler = null;
}

if (this.translationSubscription) {
this.translationSubscription.unsubscribe();
}

this.clearTimePickerTimer();
this.restoreOverlayAppend();
this.onOverlayHide();
Expand Down

0 comments on commit 27db0a4

Please sign in to comment.