diff --git a/gramps/gen/datehandler/_datedisplay.py b/gramps/gen/datehandler/_datedisplay.py index 5913dff9d..01d4a99ec 100644 --- a/gramps/gen/datehandler/_datedisplay.py +++ b/gramps/gen/datehandler/_datedisplay.py @@ -407,6 +407,9 @@ class DateDisplay: if date_val[0] == date_val[1] == 0: # No month and no day -> year value = year + elif date_val[0] == 0: + # No day -> yyyy-mm + value = "%s-%02d" % (year, date_val[1]) else: value = "%s-%02d-%02d" % (year, date_val[1], date_val[0]) if date_val[2] < 0: diff --git a/gramps/gen/datehandler/_dateparser.py b/gramps/gen/datehandler/_dateparser.py index 4dc5ea8b0..d07c6a877 100644 --- a/gramps/gen/datehandler/_dateparser.py +++ b/gramps/gen/datehandler/_dateparser.py @@ -481,7 +481,7 @@ class DateParser: % self._smon_str, re.IGNORECASE) self._numeric = re.compile( r"((\d+)[/\.]\s*)?((\d+)[/\.]\s*)?(\d+)\s*$") - self._iso = re.compile(r"(\d+)(/(\d+))?-(\d+)-(\d+)\s*$") + self._iso = re.compile(r"(\d+)(/(\d+))?-(\d+)(-(\d+))?\s*$") self._isotimestamp = re.compile( r"^\s*?(\d{4})([01]\d)([0123]\d)(?:(?:[012]\d[0-5]\d[0-5]\d)|" r"(?:\s+[012]\d:[0-5]\d(?::[0-5]\d)?))?\s*?$") @@ -630,7 +630,7 @@ class DateParser: groups = match.groups() y = self._get_int(groups[0]) m = self._get_int(groups[3]) - d = self._get_int(groups[4]) + d = self._get_int(groups[5]) if groups[2] and julian_valid((d, m, y + 1)): return (d, m, y + 1, True) # slash year if check is None or check((d, m, y)):