Adjust time display to show 24-hour format left-to-right
Modify time formatting to use 24-hour clock and enforce left-to-right display for time ranges in executive meetings.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
@@ -395,17 +395,18 @@ function computeCurrentMeetingId(
|
||||
function formatTime(t: string | null, lang: "ar" | "en"): string {
|
||||
if (!t) return "";
|
||||
// DB stores HH:mm:ss (24h). Build a Date anchored to a fixed day so
|
||||
// Intl can format the time-of-day in the user's language with AM/PM
|
||||
// (English) or ص/م (Arabic). Latin digits are enforced via the shared
|
||||
// Intl can format the time-of-day in the user's language. We use 24h
|
||||
// (no AM/PM) so the schedule shows a clean "10:00 – 11:00" without
|
||||
// the ص/م suffix in Arabic. Latin digits are enforced via the shared
|
||||
// formatTime helper. Falls back to the raw HH:mm slice if parsing
|
||||
// somehow fails (defensive — shouldn't happen for our DB shape).
|
||||
const hhmm = t.slice(0, 5);
|
||||
const parsed = new Date(`1970-01-01T${hhmm}:00`);
|
||||
if (Number.isNaN(parsed.getTime())) return hhmm;
|
||||
return i18nFormatTime(parsed, lang, {
|
||||
hour: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: true,
|
||||
hour12: false,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2586,8 +2587,12 @@ function TimeRangeCell({
|
||||
role={canMutate ? "button" : undefined}
|
||||
tabIndex={canMutate ? 0 : -1}
|
||||
aria-label={t("executiveMeetings.col.time")}
|
||||
// Force LTR so the time range always reads "10:00 – 11:00"
|
||||
// (start on the left, end on the right) regardless of the
|
||||
// surrounding RTL Arabic layout.
|
||||
dir="ltr"
|
||||
className={
|
||||
"font-mono text-[#0B1E3F] whitespace-nowrap leading-tight " +
|
||||
"font-mono text-[#0B1E3F] whitespace-nowrap leading-tight inline-block " +
|
||||
(canMutate
|
||||
? "cursor-text hover:bg-blue-50/50 focus:bg-blue-50/50 focus:outline-none rounded transition-colors px-1"
|
||||
: "")
|
||||
@@ -3246,7 +3251,7 @@ function ManageSection({
|
||||
{m.attendees.length} · {m.platform}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-3 py-2 align-middle font-mono text-xs whitespace-nowrap">
|
||||
<td className="px-3 py-2 align-middle font-mono text-xs whitespace-nowrap" dir="ltr">
|
||||
{formatTime(m.startTime, isRtl ? "ar" : "en")} — {formatTime(m.endTime, isRtl ? "ar" : "en")}
|
||||
</td>
|
||||
<td className="px-3 py-2 align-middle text-xs">
|
||||
|
||||
Reference in New Issue
Block a user