From b8357925f4058c9e5bd2959aff4e9f34d1b8d46d Mon Sep 17 00:00:00 2001 From: Todor Stoyanov Date: Thu, 30 Jan 2025 08:07:27 +0200 Subject: [PATCH 1/2] fix:(ui5-calendar) - using the correct parameter for UTC when formatting a date --- packages/main/src/Calendar.ts | 2 +- packages/main/src/YearPicker.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/main/src/Calendar.ts b/packages/main/src/Calendar.ts index a028e8519573..88d67acede22 100644 --- a/packages/main/src/Calendar.ts +++ b/packages/main/src/Calendar.ts @@ -572,7 +572,7 @@ class Calendar extends CalendarPart { const secondYearFormat = DateFormat.getDateInstance({ format: "y", calendarType: this._secondaryCalendarType }); const dateInSecType = transformDateToSecondaryType(this._primaryCalendarType, this._secondaryCalendarType, this._timestamp); const secondMonthInfo = convertMonthNumbersToMonthNames(dateInSecType.firstDate.getMonth(), dateInSecType.lastDate.getMonth(), this._secondaryCalendarType); - const secondYearText = secondYearFormat.format(localDate, true); + const secondYearText = secondYearFormat.format(localDate, false); return { yearButtonText: secondYearText, diff --git a/packages/main/src/YearPicker.ts b/packages/main/src/YearPicker.ts index 92cec5ee585f..e53691e57330 100644 --- a/packages/main/src/YearPicker.ts +++ b/packages/main/src/YearPicker.ts @@ -190,8 +190,8 @@ class YearPicker extends CalendarPart implements ICalendarPicker { if (this.hasSecondaryCalendarType) { tempDateInSecType = transformDateToSecondaryType(this._primaryCalendarType, this.secondaryCalendarType, timestamp, true); textInSecType = tempDateInSecType.firstDate.getYear() === tempDateInSecType.lastDate.getYear() - ? `${oYearFormatInSecType.format(tempDateInSecType.firstDate.toLocalJSDate(), true)}` - : `${oYearFormatInSecType.format(tempDateInSecType.firstDate.toLocalJSDate(), true)} - ${oYearFormatInSecType.format(tempDateInSecType.lastDate.toLocalJSDate(), true)}`; + ? `${oYearFormatInSecType.format(tempDateInSecType.firstDate.toLocalJSDate(), false)}` + : `${oYearFormatInSecType.format(tempDateInSecType.firstDate.toLocalJSDate(), false)} - ${oYearFormatInSecType.format(tempDateInSecType.lastDate.toLocalJSDate(), false)}`; } const year: Year = { From 6f81b9e611a4fae6bd54c0f369b18aec529f284a Mon Sep 17 00:00:00 2001 From: Vladislav Tasev Date: Thu, 30 Jan 2025 14:27:14 +0200 Subject: [PATCH 2/2] chore: review comments --- packages/main/src/Calendar.ts | 2 +- packages/main/src/YearPicker.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/main/src/Calendar.ts b/packages/main/src/Calendar.ts index 88d67acede22..a362831dd106 100644 --- a/packages/main/src/Calendar.ts +++ b/packages/main/src/Calendar.ts @@ -572,7 +572,7 @@ class Calendar extends CalendarPart { const secondYearFormat = DateFormat.getDateInstance({ format: "y", calendarType: this._secondaryCalendarType }); const dateInSecType = transformDateToSecondaryType(this._primaryCalendarType, this._secondaryCalendarType, this._timestamp); const secondMonthInfo = convertMonthNumbersToMonthNames(dateInSecType.firstDate.getMonth(), dateInSecType.lastDate.getMonth(), this._secondaryCalendarType); - const secondYearText = secondYearFormat.format(localDate, false); + const secondYearText = secondYearFormat.format(localDate); return { yearButtonText: secondYearText, diff --git a/packages/main/src/YearPicker.ts b/packages/main/src/YearPicker.ts index e53691e57330..eb8042e8aae8 100644 --- a/packages/main/src/YearPicker.ts +++ b/packages/main/src/YearPicker.ts @@ -190,8 +190,8 @@ class YearPicker extends CalendarPart implements ICalendarPicker { if (this.hasSecondaryCalendarType) { tempDateInSecType = transformDateToSecondaryType(this._primaryCalendarType, this.secondaryCalendarType, timestamp, true); textInSecType = tempDateInSecType.firstDate.getYear() === tempDateInSecType.lastDate.getYear() - ? `${oYearFormatInSecType.format(tempDateInSecType.firstDate.toLocalJSDate(), false)}` - : `${oYearFormatInSecType.format(tempDateInSecType.firstDate.toLocalJSDate(), false)} - ${oYearFormatInSecType.format(tempDateInSecType.lastDate.toLocalJSDate(), false)}`; + ? `${oYearFormatInSecType.format(tempDateInSecType.firstDate.toLocalJSDate())}` + : `${oYearFormatInSecType.format(tempDateInSecType.firstDate.toLocalJSDate())} - ${oYearFormatInSecType.format(tempDateInSecType.lastDate.toLocalJSDate())}`; } const year: Year = {