From 6de0893f638c2b0924330fea819869bd3108b7fa Mon Sep 17 00:00:00 2001 From: Claas Date: Tue, 30 Jun 2026 19:53:02 +0200 Subject: [PATCH] Add total sum for worked on day --- client/src/locales/de-DE.ftl | 1 + client/src/locales/en-US.ftl | 1 + client/src/routes/_app/times.tsx | 15 +++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/client/src/locales/de-DE.ftl b/client/src/locales/de-DE.ftl index 8869b28..7a98765 100644 --- a/client/src/locales/de-DE.ftl +++ b/client/src/locales/de-DE.ftl @@ -51,6 +51,7 @@ times-cancel = Abbrechen times-start-time-label = Startzeit times-end-time-label = Endzeit times-delete = Löschen +times-total = Gesamt # Projects projects-title = Projekte diff --git a/client/src/locales/en-US.ftl b/client/src/locales/en-US.ftl index e848978..2154991 100644 --- a/client/src/locales/en-US.ftl +++ b/client/src/locales/en-US.ftl @@ -51,6 +51,7 @@ times-cancel = Cancel times-start-time-label = Start time times-end-time-label = End time times-delete = Delete +times-total = Total # Projects projects-title = Projects diff --git a/client/src/routes/_app/times.tsx b/client/src/routes/_app/times.tsx index 7814cbb..cf03864 100644 --- a/client/src/routes/_app/times.tsx +++ b/client/src/routes/_app/times.tsx @@ -73,6 +73,15 @@ function Day(properties: VoidProps) { setIsEdit(false); } + const totalDuration = createMemo(() => + properties.times + .reduce( + (totalTime, time) => totalTime.add(time.end.since(time.start)), + Temporal.Duration.from({ milliseconds: 0 }), + ) + .round({ smallestUnit: "minute", largestUnit: "hour" }), + ); + const dayId = properties.day.toString(); const editFormId = "edit-" + dayId; @@ -208,6 +217,12 @@ function Day(properties: VoidProps) { }} +
+ {t("times-total")} + +