From 3352f5b403e03922e7e51d52e5132f06a36c2087 Mon Sep 17 00:00:00 2001 From: Diego Date: Wed, 19 Jul 2023 17:30:51 +0200 Subject: [PATCH 1/2] [#13348] - Fixed calendar component, added yearOptions onInit --- src/app/components/calendar/calendar.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/app/components/calendar/calendar.ts b/src/app/components/calendar/calendar.ts index 8fae497a085..143de255cf8 100755 --- a/src/app/components/calendar/calendar.ts +++ b/src/app/components/calendar/calendar.ts @@ -914,9 +914,9 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { overlayVisible: Nullable; - onModelChange: Function = () => {}; + onModelChange: Function = () => { }; - onModelTouched: Function = () => {}; + onModelTouched: Function = () => { }; calendarElement: Nullable; @@ -1026,6 +1026,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { this.createResponsiveStyle(); this.currentMonth = date.getMonth(); this.currentYear = date.getFullYear(); + this.yearOptions = [this.currentYear, this.currentYear + 1, this.currentYear + 2]; this.currentView = this.view; if (this.view === 'date') { @@ -2898,12 +2899,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)) { @@ -3390,4 +3391,4 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { exports: [Calendar, ButtonModule, SharedModule], declarations: [Calendar] }) -export class CalendarModule {} +export class CalendarModule { } From ee1d5ed6bcec419d06ff3b5adba6900624ac98f8 Mon Sep 17 00:00:00 2001 From: Diego Date: Sun, 27 Aug 2023 14:27:07 +0200 Subject: [PATCH 2/2] changed initialization yearOptions --- src/app/components/calendar/calendar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/calendar/calendar.ts b/src/app/components/calendar/calendar.ts index 143de255cf8..764278bdcdf 100755 --- a/src/app/components/calendar/calendar.ts +++ b/src/app/components/calendar/calendar.ts @@ -1026,7 +1026,7 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { this.createResponsiveStyle(); this.currentMonth = date.getMonth(); this.currentYear = date.getFullYear(); - this.yearOptions = [this.currentYear, this.currentYear + 1, this.currentYear + 2]; + this.yearOptions = []; this.currentView = this.view; if (this.view === 'date') {