summaryrefslogtreecommitdiff
path: root/lisp/calendar/time-date.el
diff options
context:
space:
mode:
authorKatsumi Yamaoka <yamaoka@jpl.org>2021-12-03 17:28:48 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-12-03 17:28:48 +0100
commit32a8b3bc22bfc0aeca9943699e7a43b68915122b (patch)
tree94430f32600d85e12895d24f4dbfcce49349df7a /lisp/calendar/time-date.el
parent85e56d97b717915509cb81c53238fbd06f390b92 (diff)
downloademacs-32a8b3bc22bfc0aeca9943699e7a43b68915122b.tar.gz
Fix regression introduced by the previous date-to-time change
* lisp/calendar/time-date.el (date-to-time): The function needs to test if `parse-time-string' returns a valid data as the old version did it with the help of `encode-time' (bug#52209).
Diffstat (limited to 'lisp/calendar/time-date.el')
-rw-r--r--lisp/calendar/time-date.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index 6407138953c..8a6ee0f2702 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -158,7 +158,10 @@ If DATE lacks timezone information, GMT is assumed."
(encode-time
(decoded-time-set-defaults
(condition-case err
- (parse-time-string date)
+ (let ((time (parse-time-string date)))
+ (prog1 time
+ ;; Cause an error if data `parse-time-string' returns is invalid.
+ (setq time (encode-time time))))
(error
(let ((overflow-error '(error "Specified time is not representable")))
(if (or (equal err overflow-error)