Julian/Gregorian calendar issue when entering only year as date

when running gramps in Norwegian

Fixes #10687
This commit is contained in:
Paul Franklin 2018-09-24 10:13:48 -07:00
parent e5c5a210b4
commit 2490e2d07d

View File

@ -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<start>.+)\s*(til|--|)\s*(?P<stop>.+)",
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