From 32a8b3bc22bfc0aeca9943699e7a43b68915122b Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Fri, 3 Dec 2021 17:28:48 +0100 Subject: [PATCH] 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). --- lisp/calendar/time-date.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.39.2