From 597b4b973929b6634f62796865cc172a53fd814a Mon Sep 17 00:00:00 2001 From: Jack Greenlee Date: Wed, 25 Sep 2024 01:54:58 -0400 Subject: [PATCH] fix redundant dates showing on Label tab using isoDatesDifference here (which wraps Luxon's diff) yields decimal values when a full datetime string is provided. If on the same day we are expecting the diff to be 0 (falsy) but get 0.2 or similar (truthy) All we actually need here is to know if the start and end fall on different dates, so we can simply take the YYYY-MM-DD part of the strings and test for string equality KISS --- www/js/diary/useDerivedProperties.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/js/diary/useDerivedProperties.tsx b/www/js/diary/useDerivedProperties.tsx index 4071000f7..fb9cf5c88 100644 --- a/www/js/diary/useDerivedProperties.tsx +++ b/www/js/diary/useDerivedProperties.tsx @@ -18,7 +18,8 @@ const useDerivedProperties = (tlEntry) => { const endFmt = tlEntry.end_fmt_time || tlEntry.exit_fmt_time; const beginDt = tlEntry.start_local_dt || tlEntry.enter_local_dt; const endDt = tlEntry.end_local_dt || tlEntry.exit_local_dt; - const tlEntryIsMultiDay = isoDatesDifference(beginFmt, endFmt); + // given YYYY-MM-DDTHH:MM:SSZ strings: if YYYY-MM-DD differs, is multi-day + const tlEntryIsMultiDay = beginFmt.substring(0, 10) != endFmt.substring(0, 10); return { confirmedMode: confirmedModeFor(tlEntry),