From 8c5b4e258e7576776288347b178eeb17177052aa Mon Sep 17 00:00:00 2001 From: Amirhossein Khalili Date: Sun, 26 Apr 2026 10:32:07 +0330 Subject: [PATCH] fix(timesheet): show entry date without time in mobile cards --- src/pages/Timesheet.tsx | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) 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")}