9739: Wrong parsing Numeric date format for cs_CZ locale

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

View File

@ -171,6 +171,9 @@ class DateParserCZ(DateParser):
'vyp.' : Date.QUAL_CALCULATED, '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): def init_strings(self):
DateParser.init_strings(self) DateParser.init_strings(self)
self._text2 = re.compile('(\d+)?\.?\s+?%s\.?\s*((\d+)(/\d+)?)?\s*$' self._text2 = re.compile('(\d+)?\.?\s+?%s\.?\s*((\d+)(/\d+)?)?\s*$'

View File

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