* lib/parse-datetime.y: Add the grammar for the new formats
* doc/parse-datetime.texi: Add specification and examples
---
 doc/parse-datetime.texi |  4 ++++
 lib/parse-datetime.y    | 17 +++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/doc/parse-datetime.texi b/doc/parse-datetime.texi
index b97be4a813..bbf645ae9a 100644
--- a/doc/parse-datetime.texi
+++ b/doc/parse-datetime.texi
@@ -172,6 +172,7 @@ numerically or literally.  All these strings specify the same calendar date:
 22-11-14       # Assume 19xx for 69 through 99,
                # 20xx for 00 through 68 (not recommended).
 11/14/2022     # Common U.S. writing.
+14.11.2022     # Common European writing.
 14 November 2022
 14 Nov 2022    # Three-letter abbreviations always allowed.
 November 14, 2022
@@ -184,6 +185,7 @@ used, or the current year if none.  For example:

 @example
 11/14
+14.11.
 nov 14
 @end example

@@ -200,6 +202,8 @@ is added to it; otherwise, if @var{year} is less than 100,
 then 1900 is added to it.  The construct
 @samp{@var{month}/@var{day}/@var{year}}, popular in the United States,
 is accepted.  Also @samp{@var{month}/@var{day}}, omitting the year.
+Similarly, the construct @samp{@var{day}.@var{month}.@var{year}}, popular in
+Europe, and its short form @samp{@var{day}.@var{month}.} are accepted.

 @cindex month names in date strings
 @cindex abbreviations for months
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 85a7a92cc0..e487ad9552 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -573,8 +573,8 @@ debug_print_relative_time (char const *item, parser_control const *pc)
 %parse-param { parser_control *pc }
 %lex-param { parser_control *pc }

-/* This grammar has 31 shift/reduce conflicts.  */
-%expect 31
+/* This grammar has 32 shift/reduce conflicts.  */
+%expect 32

 %union
 {
@@ -847,6 +847,19 @@ date:
             pc->year = $5;
           }
       }
+  | tUNUMBER '.' tUNUMBER '.'
+      {
+        /* E.g., 17.6.  */
+        pc->day = $1.value;
+        pc->month = $3.value;
+      }
+  | tUNUMBER '.' tUNUMBER '.' tUNUMBER
+      {
+        /* E.g., 17.6.1992  */
+        pc->day = $1.value;
+        pc->month = $3.value;
+        pc->year = $5;
+      }
   | tUNUMBER tMONTH tSNUMBER
       {
         /* E.g., 17-JUN-1992.  */
--
2.43.0


Reply via email to