branch: externals-release/org
commit de0df5b925507d6713cbefac0fdb64302ba9bf2b
Author: Kyle Meyer <k...@kyleam.com>
Commit: Ihor Radchenko <yanta...@posteo.net>

    org-test: Fix zone-dependent miscalculation of days of week
    
    * testing/org-test.el (org-test-day-of-weeks-seconds): Specify seconds
    for formatting with UTC as time zone.
    (org-test-day-of-weeks-abbrev):
    (org-test-day-of-weeks-full): Use UTC as time zone when formatting
    input.
    
    Avoid calling format-time-string with the local time zone because that
    gives the wrong result in some cases.  For example, 2222222 is
    supposed to produce the locale's name for "Tuesday" but, when the
    local time zone is +0000, (format-time-string "%A" 2222222) returns
    the locale's name for "Monday".
---
 testing/org-test.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/testing/org-test.el b/testing/org-test.el
index d9fe33284c..643c5c7660 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -549,26 +549,26 @@ TIME can be a non-nil Lisp time value, or a string 
specifying a date and time."
      (nreverse messages)))
 
 (defconst org-test-day-of-weeks-seconds
-  [121223891                            ; Sun
-   30000000                             ; Mon
-   2222222                              ; Tue
-   500000                               ; Wed
-   1000                                 ; Thu
-   89173                                ; Fri
-   666666666]                           ; Sat
+  [302400                               ; Sun
+   388800                               ; Mon
+   475200                               ; Tue
+   561600                               ; Wed
+   648000                               ; Thu
+   734400                               ; Fri
+   820800]                              ; Sat
   "Epoch seconds for generating days of week strings.
 Starts at Sunday, ends at Saturday.")
 
 (defconst org-test-day-of-weeks-abbrev
   (apply #'vector
-         (seq-map (apply-partially #'format-time-string "%a")
+         (seq-map (lambda (s) (format-time-string "%a" s t))
                   org-test-day-of-weeks-seconds))
   "Vector of abbreviated names of days of week.
 See `org-test-day-of-weeks-seconds'.")
 
 (defconst org-test-day-of-weeks-full
   (apply #'vector
-         (seq-map (apply-partially #'format-time-string "%A")
+         (seq-map (lambda (s) (format-time-string "%A" s t))
                   org-test-day-of-weeks-seconds))
   "Vector of full names for days of week.
 See `org-test-day-of-weeks-seconds'.")

Reply via email to