Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-09-07 15:21:35 +02:00
commit 6cfc7cb958
2 changed files with 5 additions and 1 deletions

View File

@ -272,11 +272,13 @@ When optional argument CANONICAL is non-nil, refer to
When optional argument CANONICAL is non-nil, ignore
`org-duration-units' and use standard time units value.
As a special case, a bare number represents minutes.
A bare number is translated into minutes. The empty string is
translated into 0.0.
Return value as a float. Raise an error if duration format is
not recognized."
(cond
((equal duration "") 0.0)
((numberp duration) (float duration))
((string-match-p org-duration--h:mm-re duration)
(pcase-let ((`(,hours ,minutes ,seconds)

View File

@ -35,6 +35,8 @@
(should (= (org-duration-to-minutes "2") 2))
(should (= (org-duration-to-minutes "2.5") 2.5))
(should (= (org-duration-to-minutes 1) 1))
;; Special case: the empty string is 0.0.
(should (= (org-duration-to-minutes "") 0.0))
;; Support custom units.
(should (= 4
(let ((org-duration-units '(("longmin" . 2)))