DateHandler/_Date_fr.py : try to avoid negative dates conversion (B.C.E)
svn: r8944
This commit is contained in:
parent
3ffc1a8af9
commit
cf1ca2c224
@ -170,13 +170,13 @@ class DateParserFR(DateParser):
|
|||||||
# This self._text are different from the base
|
# This self._text are different from the base
|
||||||
# by adding ".?" after the first date and removing "\s*$" at the end
|
# by adding ".?" after the first date and removing "\s*$" at the end
|
||||||
#gregorian and julian
|
#gregorian and julian
|
||||||
self._text2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._mon_str,
|
self._text2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._mon_str,
|
||||||
re.IGNORECASE)
|
re.IGNORECASE)
|
||||||
#hebrew
|
#hebrew
|
||||||
self._jtext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._jmon_str,
|
self._jtext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._jmon_str,
|
||||||
re.IGNORECASE)
|
re.IGNORECASE)
|
||||||
#french
|
#french
|
||||||
self._ftext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._fmon_str,
|
self._ftext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._fmon_str,
|
||||||
re.IGNORECASE)
|
re.IGNORECASE)
|
||||||
#persian
|
#persian
|
||||||
self._ptext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._pmon_str,
|
self._ptext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._pmon_str,
|
||||||
@ -213,7 +213,7 @@ class DateDisplayFR(DateDisplay):
|
|||||||
if self.format == 0:
|
if self.format == 0:
|
||||||
return self.display_iso(date_val)
|
return self.display_iso(date_val)
|
||||||
elif self.format == 1:
|
elif self.format == 1:
|
||||||
if date_val[3]:
|
if date_val[2] < 0 or date_val[3]:
|
||||||
return self.display_iso(date_val)
|
return self.display_iso(date_val)
|
||||||
else:
|
else:
|
||||||
if date_val[0] == 0 and date_val[1] == 0:
|
if date_val[0] == 0 and date_val[1] == 0:
|
||||||
@ -270,6 +270,23 @@ class DateDisplayFR(DateDisplay):
|
|||||||
else:
|
else:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
def _display_french(self, date_val):
|
||||||
|
year = date_val[2]
|
||||||
|
if date_val[0] == 0:
|
||||||
|
if date_val[1] == 0:
|
||||||
|
value = year
|
||||||
|
else:
|
||||||
|
value = u"%s %d" % (self.french[date_val[1]], year)
|
||||||
|
# convertion mistake before 22.9.1792
|
||||||
|
elif date_val[2] == 0 and date_val[1] == 13:
|
||||||
|
# from 17.9.1792 to 21.9.1792 : trap for Extra months, we cannot date back
|
||||||
|
return self._bce_str % year
|
||||||
|
# on 1792 before 22.9.1792, no negative years
|
||||||
|
elif date_val[2] < 0:
|
||||||
|
return self._bce_str % year
|
||||||
|
# valid dates on 1792
|
||||||
|
else:
|
||||||
|
return u"%s %s %d" % (date_val[0], self.french[date_val[1]], year)
|
||||||
|
|
||||||
def display(self, date):
|
def display(self, date):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user