Hi,
I'm trying to start using `org-habit' but I noticed that hourly repeats
are not properly parsed by `org-habit-duration-to-days', however that's
a valid use case --- e.g. drinking water, medicine schedule,
physiotherapy sessions during the day, periodically practicing a new
language. For example, here's an easy TODO item that reproduces the
problem:
8< -------------------- cut here --------------------
* TODO Foo
SCHEDULED: <2023-01-18 Wed 11:00 .+8h>
:PROPERTIES:
:STYLE: habit
:END:
8< -------------------- cut here --------------------
It appears that a simple solution would be modify
`org-habit-duration-to-days' to accept the `h' suffix and set it to a
fraction of a day, something like:
8< -------------------- cut here --------------------
(defun org-habit-duration-to-days (ts)
(if (string-match "\\([0-9]+\\)\\([hdwmy]\\)" ts)
;; lead time is specified.
(floor (* (string-to-number (match-string 1 ts))
(cdr (assoc (match-string 2 ts)
'(("h" . 0.042) ("d" . 1)
("w" . 7) ("m" . 30.4)
("y" . 365.25))))))
(error "Invalid duration string: %s" ts)))
8< -------------------- cut here --------------------
Would something like this be an acceptable solution?
--
balbi