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 <adhabal2002@gmail.com>
This commit is contained in:
xDipzz
2026-01-08 14:25:50 +00:00
committed by GitHub
co-authored by Pallav Anik Dhabal Babu
parent 2f932f617c
commit f629b61be7
@@ -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) => {