Subject: bug#52209: 28.0.60; [PATCH] date-to-time fails on pure dates

From: Bob Rogers <[email-masked]>
Date: Thu, 24 Feb 2022 21:58:17 -0500

From: Bob Rogers <[email-masked]>
   Date: Thu, 24 Feb 2022 21:32:27 -0500

      From: Lars Ingebrigtsen <[email-masked]>
      Date: Fri, 25 Feb 2022 03:16:56 +0100

      Bob Rogers <[email-masked]> writes:

      > Here it is; there should be no changes from what I last sent other than
      > from the suggestions you and Andreas made.  Thanks,

      I got a test error:

   Hmm.  I bet we have a timezone issue . . .

Yep; here's a fix, to be applied to the previous patch.

					-- Bob

From 93a92360e5ea514236366f978aa5a71e7662ba1a Mon Sep 17 00:00:00 2001
From: Bob Rogers <[email-masked]>
Date: Thu, 24 Feb 2022 21:55:30 -0500
Subject: [PATCH] Fix an ietf-drums-parse-date test without TZ

* test/lisp/mail/ietf-drums-date-tests.el:
   + (ietf-drums-date-tests):  Bug fix:  Input to ietf-drums-parse-date
     must have a timezone, otherwise the output depends on the test
     environment TZ.  Also add some tests without TZ, & fix indentation.
---
 test/lisp/mail/ietf-drums-date-tests.el | 36 +++++++++++++++++--------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/test/lisp/mail/ietf-drums-date-tests.el b/test/lisp/mail/ietf-drums-date-tests.el
index 2d4b39dfae..5b798077ff 100644
--- a/test/lisp/mail/ietf-drums-date-tests.el
+++ b/test/lisp/mail/ietf-drums-date-tests.el
@@ -72,18 +72,32 @@ ietf-drums-date-tests
                   ("Friday, 21 Sep 2018 13:47:58 PDT"
                    (58 47 13 21 9 2018 5 t -25200)
                    (23461 22782))
-                  ("Friday, 21 Sep 2018 13:47:58"
-                   (58 47 13 21 9 2018 5 -1 nil)
+                  ("Friday, 21 Sep 2018 13:47:58 EDT"
+                   (58 47 13 21 9 2018 5 t -14400)
                    (23461 11982))))
-            (let* ((input (car case))
-                   (parsed (cadr case))
-                   (encoded (caddr case)))
-              ;; The input should parse the same without RFC822.
-              (should (equal (ietf-drums-parse-date-string input) parsed))
-              (should (equal (ietf-drums-parse-date-string input nil t) parsed))
-              ;; Check the encoded date (the official output, though
-              ;; the decoded-time is easier to debug).
-              (should (equal (ietf-drums-parse-date input) encoded))))
+    (let* ((input (car case))
+           (parsed (cadr case))
+           (encoded (caddr case)))
+      ;; The input should parse the same without RFC822.
+      (should (equal (ietf-drums-parse-date-string input) parsed))
+      (should (equal (ietf-drums-parse-date-string input nil t) parsed))
+      ;; Check the encoded date (the official output, though the
+      ;; decoded-time is easier to debug).
+      (should (equal (ietf-drums-parse-date input) encoded))))
+
+  ;; Test a few without timezones.
+  (dolist (case '(("Mon, 22 Feb 2016 19:35:42"
+                   (42 35 19 22 2 2016 1 -1 nil))
+                  ("Friday, 21 Sep 2018 13:47:58"
+                   (58 47 13 21 9 2018 5 -1 nil))))
+    (let* ((input (car case))
+           (parsed (cadr case)))
+      ;; The input should parse the same without RFC822.
+      (should (equal (ietf-drums-parse-date-string input) parsed))
+      (should (equal (ietf-drums-parse-date-string input nil t) parsed))
+      ;; We can't check the encoded date here because it will differ
+      ;; depending on the TZ of the test environment.
+      ))
 
   ;; Two-digit years are not allowed by the "modern" format.
   (should (equal (ietf-drums-parse-date-string "22 Feb 16 19:35:42 +0100")
-- 
2.34.1