Skip to content

Commit

Permalink
Logbook: handle mid-week month switches better
Browse files Browse the repository at this point in the history
The effective moment of a mid-week month change is the same as the
effective moment of the last day of last month.
  • Loading branch information
bcobb committed Aug 1, 2018
1 parent 5b5006c commit eb4a6b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bcobb/bcobb-logbook.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
(defun logbook--effective-moment (&optional reference)
(if (and (logbook--beginning-of-month-p reference)
(logbook--week-includes-last-month-p reference))
(logbook--n-days-ago (logbook--day-of-month reference) reference)
(logbook--effective-moment
(logbook--n-days-ago (logbook--day-of-month reference) reference))
(let ((now (or reference (current-time))))
(logbook--n-days-ago (- (logbook--day-of-week now) 1) now))))

Expand Down

0 comments on commit eb4a6b1

Please sign in to comment.