On 24/04/2023 02:06, Marcin Borkowski wrote:
Fair enough. Still, I consider this a bug in the docs (they don't say clearly to set :wstart 7)...
I do not think :wstart 7 gives expected result when run on any day other than Sunday. Current expression shifts interval start into future, see the last column
#+begin_src elisp (let ((dow-seq (number-sequence 0 6)) (wstart-seq (number-sequence 0 7)) (shift 0) (diff (lambda (dow ws) ; taken from org-clock.el: (+ (* -7 shift) (if (= dow 0) (- 7 ws) (- dow ws)))))) (cons (cons "dow\\wstart" wstart-seq) (mapcar (lambda (dow) (cons dow (mapcar (lambda (ws) (funcall diff dow ws)) wstart-seq))) dow-seq))) #+end_src #+RESULTS: | dow\wstart | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | | 1 | 1 | 0 | -1 | -2 | -3 | -4 | -5 | -6 | | 2 | 2 | 1 | 0 | -1 | -2 | -3 | -4 | -5 | | 3 | 3 | 2 | 1 | 0 | -1 | -2 | -3 | -4 | | 4 | 4 | 3 | 2 | 1 | 0 | -1 | -2 | -3 | | 5 | 5 | 4 | 3 | 2 | 1 | 0 | -1 | -2 | | 6 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | -1 | My expectation is values like in column "1" with appropriate cyclic shift.