org-habit keeps track of my habits, e.g. taking a piece of melatonin pill every day before bed. Sometimes I go to sleep after midnight. I don't want the habit to count as failed in this case. I want orgmode and org-habit let me check the habit before or after midnight. How do I do that?

Right now I have it scheduled like this: SCHEDULED: <2017-10-04 Wed .+1d>

The other problem is that if I check it at 2 am, then it list it in the agenda on that day even if I want to go to sleep before midnight.


1 Answer 1


You can set:

(setq org-extend-today-until 4)

And then use either org-agenda-todo to mark a habit as done after midnight or org-agenda-todo-yesterday to mark it done before midnight, as you prefer.

Alternatively, see the related link that Juancho pointed to for how to make org-agenda-todo (and org-todo) always use the previous "clock day" when marking items as done in the small hours of the morning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.