From f629b61be7d4787c1afea7cbd4c5b87f59b69db0 Mon Sep 17 00:00:00 2001 From: xDipzz <155362028+xDipzz@users.noreply.github.com> Date: Thu, 8 Jan 2026 19:55:50 +0530 Subject: [PATCH] fix: capitalize German 'Uhr' in 24-hour time format (#25403) * fix: capitalize German 'Uhr' in 24-hour time format - Conditionally apply toLowerCase() only for 12-hour format (AM/PM) - Preserve proper capitalization for 24-hour format in German and other locales - German 'Uhr' now displays correctly as 'Uhr' instead of 'uhr' Fixes #24455 * refactor: remove code comments for clarity * use ternary in return instead of mutable variable * refactor: remove toLowerCase from time formatting * addressed cubic suggestion --------- Co-authored-by: Pallav <90088723+Pallava-Joshi@users.noreply.github.com> Co-authored-by: Anik Dhabal Babu --- .../features/bookings/Booker/utils/dates.tsx | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/features/bookings/Booker/utils/dates.tsx b/packages/features/bookings/Booker/utils/dates.tsx index 5e1b0ac6ea..6d123085f7 100644 --- a/packages/features/bookings/Booker/utils/dates.tsx +++ b/packages/features/bookings/Booker/utils/dates.tsx @@ -26,11 +26,15 @@ export const formatEventFromTime = ({ date, timeFormat, timeZone, language }: Ev timeZone, timeStyle: "short", hour12: timeFormat === TimeFormat.TWELVE_HOUR ? true : false, - }) - .format(startDate) - .toLowerCase(); + }).format(startDate); - return { date: formattedDate, time: formattedTime }; + return { + date: formattedDate, + time: + timeFormat === TimeFormat.TWELVE_HOUR + ? formattedTime.toLowerCase() + : formattedTime, + }; }; export const formatEventFromToTime = ({ @@ -54,11 +58,15 @@ export const formatEventFromToTime = ({ timeZone, timeStyle: "short", hour12: timeFormat === TimeFormat.TWELVE_HOUR ? true : false, - }) - .formatRange(startDate, endDate) - .toLowerCase(); + }).formatRange(startDate, endDate); - return { date: formattedDate, time: formattedTime }; + return { + date: formattedDate, + time: + timeFormat === TimeFormat.TWELVE_HOUR + ? formattedTime.toLowerCase() + : formattedTime, + }; }; export const FromToTime = (props: EventFromToTime) => {