Make Org future-proof
* lisp/org.el (org-small-year-to-year): Do not hardcode 2037 as the last future year for Org. Always foresee the next 30 years.
This commit is contained in:
parent
fb906e15d7
commit
f212f7cf0d
17
lisp/org.el
17
lisp/org.el
|
@ -17456,14 +17456,15 @@ The variable `date' is bound by the calendar when this is called."
|
|||
|
||||
(defun org-small-year-to-year (year)
|
||||
"Convert 2-digit years into 4-digit years.
|
||||
38-99 are mapped into 1938-1999. 1-37 are mapped into 2001-2037.
|
||||
The year 2000 cannot be abbreviated. Any year larger than 99
|
||||
is returned unchanged."
|
||||
(if (< year 38)
|
||||
(setq year (+ 2000 year))
|
||||
(if (< year 100)
|
||||
(setq year (+ 1900 year))))
|
||||
year)
|
||||
YEAR is expanded into one of the 30 next years, if possible, or
|
||||
into a past one. Any year larger than 99 is returned unchanged."
|
||||
(if (>= year 100) year
|
||||
(let* ((current (string-to-number (format-time-string "%Y" (current-time))))
|
||||
(century (/ current 100))
|
||||
(offset (- year (% current 100))))
|
||||
(cond ((> offset 30) (+ (* (1- century) 100) year))
|
||||
((> offset -70) (+ (* century 100) year))
|
||||
(t (+ (* (1+ century) 100) year))))))
|
||||
|
||||
(defun org-time-from-absolute (d)
|
||||
"Return the time corresponding to date D.
|
||||
|
|
Loading…
Reference in New Issue