bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch: date formats


From: Martin Renold
Subject: patch: date formats
Date: Thu, 15 May 2003 18:03:27 +0200
User-agent: Mutt/1.3.28i

Hi,

This patch makes cvs understand dates like "DD.MM.YYYY" (the one we learn
in school here), and additionally "two days ago" (instead of 
"2 days ago").

I could not figure out how to make "DD.MM. HH:MM"  working cleanly,
because the parser overlooks the space and thinks HH is the year. I tried
a new token tUNUMBER_DOT but it messed the whole thing up and I reversed
those changes.

By the way, "15.5.03" will not work as expected, it's a y2k issue. The
best way would be to interprete two digit years between CURRENTYEAR - 49
and CURRENTYEAR + 50, but, well...

Please CC me any comments, I am not subscribed.

bye,
Martin

Index: lib/getdate.y
===================================================================
RCS file: /cvs/ccvs/lib/getdate.y,v
retrieving revision 1.18
diff -u -r1.18 getdate.y
--- lib/getdate.y       23 Jan 2003 21:16:36 -0000      1.18
+++ lib/getdate.y       15 May 2003 16:28:08 -0000
@@ -305,6 +305,20 @@
            yyDay = $1;
            yyYear = $3;
        }
+       | tUNUMBER '.' {
+           yyDay = $1;
+       }
+       | tUNUMBER '.' tUNUMBER '.' {
+           /* FIXME: "22:00 19.4." will work, but "19.4. 22:00" will not
+            * because the parser eats the space */
+           yyDay = $1;
+           yyMonth = $3;
+       }
+       | tUNUMBER '.' tUNUMBER '.' tUNUMBER {
+           yyDay = $1;
+           yyMonth = $3;
+           yyYear = $5;
+       }
        ;
 
 rel    : relunit tAGO {
@@ -433,6 +447,18 @@
     { "last",          tUNUMBER,       -1 },
     { "this",          tMINUTE_UNIT,   0 },
     { "next",          tUNUMBER,       2 },
+    { "one",           tUNUMBER,       1 },
+    { "two",           tUNUMBER,       2 },
+    { "three",         tUNUMBER,       3 },
+    { "four",          tUNUMBER,       4 },
+    { "five",          tUNUMBER,       5 },
+    { "six",           tUNUMBER,       6 },
+    { "seven",         tUNUMBER,       7 },
+    { "eight",         tUNUMBER,       8 },
+    { "nine",          tUNUMBER,       9 },
+    { "ten",           tUNUMBER,       10 },
+    { "eleven",                tUNUMBER,       11 },
+    { "twelve",                tUNUMBER,       12 },
     { "first",         tUNUMBER,       1 },
 /*  { "second",                tUNUMBER,       2 }, */
     { "third",         tUNUMBER,       3 },
Index: man/cvs.1
===================================================================
RCS file: /cvs/ccvs/man/cvs.1,v
retrieving revision 1.35
diff -u -r1.35 cvs.1
--- man/cvs.1   19 Mar 2003 21:13:30 -0000      1.35
+++ man/cvs.1   15 May 2003 16:28:12 -0000
@@ -486,6 +486,7 @@
 yesterday
 a fortnight ago
 3/31/92 10:00:07 PST
+16:40 15.5.
 January 23, 1987 10:05pm
 22:00 GMT
 .fi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]