diff --git a/src/pages/Timesheet.tsx b/src/pages/Timesheet.tsx index c6dc860..e9e458e 100644 --- a/src/pages/Timesheet.tsx +++ b/src/pages/Timesheet.tsx @@ -168,15 +168,24 @@ const combineDateAndTime = (dateValue: string, timeValue: string) => { return new Date(year, month - 1, day, hours, minutes, seconds, 0).toISOString(); }; -const formatDateTime = (value: string, locale: "en" | "fa") => { - const parsed = parseApiDateTime(value); - if (!parsed) return value; - - return new Intl.DateTimeFormat(locale === "fa" ? "fa-IR" : "en-US", { - dateStyle: "medium", - timeStyle: "medium", - }).format(parsed); -}; +const formatDateTime = (value: string, locale: "en" | "fa") => { + const parsed = parseApiDateTime(value); + if (!parsed) return value; + + return new Intl.DateTimeFormat(locale === "fa" ? "fa-IR" : "en-US", { + dateStyle: "medium", + timeStyle: "medium", + }).format(parsed); +}; + +const formatDateOnly = (value: string, locale: "en" | "fa") => { + const parsed = parseApiDateTime(value); + if (!parsed) return value; + + return new Intl.DateTimeFormat(locale === "fa" ? "fa-IR" : "en-US", { + dateStyle: "medium", + }).format(parsed); +}; const formatDuration = (entry: TimeEntry, now = Date.now()) => { const start = parseApiDateTime(entry.start_time)?.getTime(); @@ -1557,6 +1566,7 @@ function MobileRecordedEntryCard({
{formatTimeOnly(entry.start_time)} - {formatTimeOnly(entry.end_time)} + {formatDateOnly(entry.start_time, "en")}