fix(timesheet): show entry date without time in mobile cards
This commit is contained in:
@@ -178,6 +178,15 @@ const formatDateTime = (value: string, locale: "en" | "fa") => {
|
||||
}).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();
|
||||
const end = entry.end_time ? parseApiDateTime(entry.end_time)?.getTime() : now;
|
||||
@@ -1555,9 +1564,9 @@ function MobileRecordedEntryCard({
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-slate-500 dark:text-slate-400">
|
||||
<span>{formatTimeOnly(entry.start_time)} - {formatTimeOnly(entry.end_time)}</span>
|
||||
</div>
|
||||
<div className="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-slate-500 dark:text-slate-400">
|
||||
<span>{formatTimeOnly(entry.start_time)} - {formatTimeOnly(entry.end_time)}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="shrink-0 text-right">
|
||||
|
||||
Reference in New Issue
Block a user