emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* A small fix in `org-read-date-analyze'
@ 2016-03-17 11:52 Marcin Borkowski
  2016-03-17 12:02 ` Marcin Borkowski
  0 siblings, 1 reply; 13+ messages in thread
From: Marcin Borkowski @ 2016-03-17 11:52 UTC (permalink / raw)
  To: Org-Mode mailing list

[-- Attachment #1: Type: text/plain, Size: 276 bytes --]

Hi,

I attach a simple patch to enhance handling of two-digit years in
`org-read-date-analyze'.  (I have the FSF papers signed.)

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Enhance-year-handling.patch --]
[-- Type: text/x-patch, Size: 908 bytes --]

From 6406c46fe1394b107e87012696f058fe5f13215e Mon Sep 17 00:00:00 2001
From: Marcin Borkowski <mbork@mbork.pl>
Date: Thu, 17 Mar 2016 12:50:12 +0100
Subject: [PATCH] Enhance year handling

* lisp/org.el (org-read-date-analyze): Handle two-digit years with
`org-small-year-to-year' instead of just adding 2000
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 1f06cbd..9b3af05 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17011,7 +17011,7 @@ user."
 			  (string-to-number (format-time-string "%Y"))))
 	    month (string-to-number (match-string 3 ans))
 	    day (string-to-number (match-string 4 ans)))
-      (when (< year 100) (setq year (+ 2000 year)))
+      (when (< year 100) (setq year (org-small-year-to-year year)))
       (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
 			       t nil ans)))
 
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-03-24 19:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-17 11:52 A small fix in `org-read-date-analyze' Marcin Borkowski
2016-03-17 12:02 ` Marcin Borkowski
2016-03-17 22:12   ` Nicolas Goaziou
2016-03-18  5:40     ` Marcin Borkowski
2016-03-18 13:34       ` Nicolas Goaziou
2016-03-18 16:51         ` A proposed enhancement in entering timestamps (was: A small fix in `org-read-date-analyze') Marcin Borkowski
2016-03-18 19:02           ` A proposed enhancement in entering timestamps Samuel W. Flint
2016-03-18 20:26           ` Eric S Fraga
2016-03-22 20:28           ` A proposed enhancement in entering timestamps (was: A small fix in `org-read-date-analyze') Marcin Borkowski
2016-03-24 13:09             ` A proposed enhancement in entering timestamps Nicolas Goaziou
2016-03-24 15:03               ` Marcin Borkowski
2016-03-24 15:30                 ` Robert Horn
2016-03-24 19:38                   ` Marcin Borkowski

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).