From 2490e2d07d153c2bfda4a6bb2c3cc025044ea2e8 Mon Sep 17 00:00:00 2001 From: Paul Franklin Date: Mon, 24 Sep 2018 10:13:48 -0700 Subject: [PATCH] Julian/Gregorian calendar issue when entering only year as date when running gramps in Norwegian Fixes #10687 --- gramps/gen/datehandler/_date_nb.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gramps/gen/datehandler/_date_nb.py b/gramps/gen/datehandler/_date_nb.py index f126e43a4..eaec57795 100644 --- a/gramps/gen/datehandler/_date_nb.py +++ b/gramps/gen/datehandler/_date_nb.py @@ -58,6 +58,7 @@ class DateParserNb(DateParser): 'innen' : Date.MOD_BEFORE, 'etter' : Date.MOD_AFTER, 'omkring' : Date.MOD_ABOUT, + 'omtrent' : Date.MOD_ABOUT, 'ca' : Date.MOD_ABOUT } @@ -89,8 +90,8 @@ class DateParserNb(DateParser): def init_strings(self): DateParser.init_strings(self) - # match day. month year - self._numeric = re.compile(r"((\d+)[\.])?\s*((\d+))?\s*(\d+)$") + self._numeric = re.compile( + r"((\d+)[/\.\s]\s*)?((\d+)[/\.\-\s]\s*)?(\d+)\s*$") self._span = re.compile( r"(fra)?\s*(?P.+)\s*(til|--|–)\s*(?P.+)", re.IGNORECASE) @@ -174,6 +175,10 @@ class DateDisplayNb(DateDisplay): return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, scal) + def dd_dformat01(self, date_val): + """ numerical -- for Norwegian dates """ + return DateDisplay.dd_dformat01(self, date_val).lstrip() + #------------------------------------------------------------------------- # # Register classes