Skip to content

Commit

Permalink
fix redundant dates showing on Label tab
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JGreenlee committed Sep 25, 2024
1 parent bc01697 commit 597b4b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion www/js/diary/useDerivedProperties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 597b4b9

Please sign in to comment.