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).
This commit is contained in:
Katsumi Yamaoka 2021-12-03 17:28:48 +01:00 committed by Lars Ingebrigtsen
parent 85e56d97b7
commit 32a8b3bc22

View file

@ -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)