From ad333e937cf98dafd4650e75804402a7b2366baa Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Sat, 14 Sep 2013 15:11:09 +0000 Subject: [PATCH] 7045: Setting an invalid date does not raise do the sanity checks on a separate date object, so that the uncertainty expressed with 0 d/m isn't removed svn: r23124 --- gramps/gen/lib/date.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gramps/gen/lib/date.py b/gramps/gen/lib/date.py index f224e896a..0f41f1645 100644 --- a/gramps/gen/lib/date.py +++ b/gramps/gen/lib/date.py @@ -1587,11 +1587,15 @@ class Date(object): self.sortval += (d1_val - d2_val) + 1 if modifier != Date.MOD_TEXTONLY: - self.convert_calendar(self.calendar, known_valid = False) + sanity = Date(self) + sanity.convert_calendar(self.calendar, known_valid = False) + # We don't do the roundtrip conversion on self, becaue + # it would remove uncertainty on day/month expressed with zeros + # Did the roundtrip change the date value?! - if self.dateval != value: + if sanity.dateval != value: # Maybe it is OK because of undetermined value adjustment? - zl = zip(self.dateval, value) + zl = zip(sanity.dateval, value) # Loop over all values present, whether compound or not for d,m,y,sl in zip(*[iter(zl)]*4): # each of d,m,y,sl is a pair from dateval and value, to compare