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

[#13348] - Fixed calendar component, added yearOptions onInit #13349

Merged
merged 3 commits into from
Aug 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -921,9 +921,9 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {

overlayVisible: Nullable<boolean>;

onModelChange: Function = () => {};
onModelChange: Function = () => { };

onModelTouched: Function = () => {};
onModelTouched: Function = () => { };

calendarElement: Nullable<HTMLElement | ElementRef>;

Expand Down Expand Up @@ -1033,6 +1033,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
this.createResponsiveStyle();
this.currentMonth = date.getMonth();
this.currentYear = date.getFullYear();
this.yearOptions = [];
this.currentView = this.view;

if (this.view === 'date') {
Expand Down Expand Up @@ -2911,12 +2912,12 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {

let iFormat!: any;
const lookAhead = (match: string) => {
const matches = iFormat + 1 < format.length && format.charAt(iFormat + 1) === match;
if (matches) {
iFormat++;
}
return matches;
},
const matches = iFormat + 1 < format.length && format.charAt(iFormat + 1) === match;
if (matches) {
iFormat++;
}
return matches;
},
formatNumber = (match: string, value: any, len: any) => {
let num = '' + value;
if (lookAhead(match)) {
Expand Down Expand Up @@ -3402,4 +3403,4 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
exports: [Calendar, ButtonModule, SharedModule],
declarations: [Calendar]
})
export class CalendarModule {}
export class CalendarModule { }