Skip to content

Commit fb7b6b6

Browse files
committed
Snap to previous day if we haven't passed the dayoffset yet
1 parent bc577a3 commit fb7b6b6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

timetagger/app/front.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ def get_today_range(self):
411411
# The math
412412
t1_actual = dt.floor(now, "1D")
413413
t1 = dt.add(t1_actual, today_snap_offset) if today_snap_offset else t1_actual
414+
# If it's after midnight, we might still be in the previous offset day.
415+
if t1 > now:
416+
t1 = dt.add(t1, "-1D")
414417
t2 = dt.add(t1, "1D")
415418
t2 = dt.add(t2, today_end_offset) if today_end_offset else t2
416419
# Toggle to a full day (0h-24h) if the range already matches.

0 commit comments

Comments
 (0)