9739: Wrong parsing Numeric date format for cs_CZ locale

This commit is contained in:
Paul Franklin 2016-10-12 13:16:13 -07:00
parent b2775b3892
commit ac00bd1843
2 changed files with 5 additions and 2 deletions

View File

@ -171,6 +171,9 @@ class DateParserCZ(DateParser):
'vyp.' : Date.QUAL_CALCULATED,
}
# bug 9739 _grampslocale.py gets '%-d.%-m.%Y' and makes it be '%/d.%/m.%Y'
fmt = DateParser.fmt.replace('/', '') # so counteract that
def init_strings(self):
DateParser.init_strings(self)
self._text2 = re.compile('(\d+)?\.?\s+?%s\.?\s*((\d+)(/\d+)?)?\s*$'

View File

@ -194,6 +194,7 @@ class DateParser(object):
_locale = GrampsLocale(lang='en', languages='en')
fmt = _grampslocale.tformat
_fmt_parse = re.compile(".*%(\S).*%(\S).*%(\S).*")
# RFC-2822 only uses capitalized English abbreviated names, no locales.
@ -343,8 +344,7 @@ class DateParser(object):
Date.CAL_SWEDISH : self._parse_swedish,
}
fmt = _grampslocale.tformat
match = self._fmt_parse.match(fmt.lower())
match = self._fmt_parse.match(self.fmt.lower())
if match:
self.dmy = (match.groups() == ('d', 'm', 'y') or \
match.groups() == ('d', 'b', 'y'))