I'm afraid override calendar-iso-from-absolute
is not a good idea, it will mess thing up.
The line "Week-agenda (W01):" is generated by org-agenda-list
, but it will generate something like "Week-agenda (W01-w04):" due to the different view (month view, for example). So this line is not suitable for modifying.
The other line "Monday 11 April 2022 W15" is generated by org-agenda-format-date-aligned
, it is suitable to attach additional information.
(defun org-days-to-relative-week (days-now days-start)
"Compute weeks between two date.
DAYS-NOW and DAYS-START are both days from absolute gregorian"
(1+ (/ (- days-now days-start) 7)))
(defun my-org-agenda-format-date-aligned (orig-fun date)
(let ((day-of-week (calendar-day-of-week date))
(custom-week (org-days-to-relative-week
(calendar-absolute-from-gregorian date))
(org-days-to-relative-week
(calendar-absolute-from-gregorian '(2 28 2002))))
(orig-str (funcall orig-fun date)))
(if (and custom-week (= 1 day-of-week))
(format "%s | Week %02d" orig-str custom-week)
orig-str)))
(advice-add 'org-agenda-format-date-aligned :around #'my-org-agenda-format-date-aligned)