Here's the updated patch based on the recommendations. One note about behavior for the fall back time (e.g. EDT 2025-11-02 1:59): the current behavior for fall back doesn't wrap, but I think that's actually OK. If we wrapped at the transition from 1:59 -> 1:00 then org-shiftup would basically get trapped at that boundary and couldn't go past it. I think the current behavior of 1:55 -> 2:00 makes sense because unlike the spring-forward case, the shift can't result in an invalid time.
Cheers, Derek On Sun, Apr 5, 2026 at 12:46 PM Morgan Smith <[email protected]> wrote: > Thanks for the patch! I've been meaning to get around to testing DST > stuff. I haven't tried this patch out yet but wanted to comment on the > testing style a little. Just nitpicks really so please bear with me. > > Derek Chen-Becker <[email protected]> writes: > > > +(ert-deftest test-org/org-timestamp-change-dst () > > + "Test that `org-timestamp-change' properly errors at DST boundaries." > > + ;; Using the process environment to ensure the correct timezone for > this test > > + (let ((process-environment (cons "TZ=America/New_York" > process-environment))) > > You can use the macro `org-test-with-timezone' like what is done in > `test-org-habit/dst'. > > > + ;; Shifting the hour from 3:05 to 2:05 falls into the gap and > should error > > + (should-error > > + (org-test-with-temp-text "<2026-03-08 Sun 03:05>" > > + (forward-char 16) ;; Put the cursor on > the hour > > + (org-timestamp-change -1 'hour) > > Instead of the `forward-char', you can simply do: > > (org-test-with-temp-text "<2026-03-08 Sun 03<point>:05>" > > Also you shouldn't need to set the point since you are passing in a > value to the optional argument WHAT. > > > + :type 'user-error > > + )) > > + ;; Shifting the minutes from 3:00 to 2:55 falls into the gap and > should error > > + (should-error > > + (org-test-with-temp-text "<2026-03-08 Sun 03:00>" > > + (forward-char 19) ;; Put the cursor on > the minute > > + (org-timestamp-change -1 'minute) > > + :type 'user-error > > + )))) > > First, I would love a comment telling me what DST is occuring like the > comment I wrote in `test-org-habit/dst' which says: > > ;; DST transition (spring forward) [2009-03-08 01:59] -> [2009-03-08 03:00] > > Second, I would love to see tests for the other DST transition (fall > back). > > > I hope you find these comments helpful! I'm really excited to see > progress on DST bugs! > -- +---------------------------------------------------------------+ | Derek Chen-Becker | | GPG Key available at https://keybase.io/dchenbecker and | | https://pgp.mit.edu/pks/lookup?search=derek%40chen-becker.org | | Fngrprnt: EB8A 6480 F0A3 C8EB C1E7 7F42 AFC5 AFEE 96E4 6ACC | +---------------------------------------------------------------+
0001-lisp-org.el-Error-when-timestamp-shift-hits-DST-gap.patch
Description: Binary data
