Fixed two errors: simple str(date) now shows alternate newyear day; match with alt newyear day now works correctly
svn: r13390
This commit is contained in:
parent
0802b891df
commit
c202f43e9b
@ -913,6 +913,7 @@ class Date(object):
|
||||
datecopy = Date(self)
|
||||
#we do all calculation in Gregorian calendar
|
||||
datecopy.convert_calendar(Date.CAL_GREGORIAN)
|
||||
|
||||
start = yr_mon_day(datecopy.get_start_date())
|
||||
stop = yr_mon_day(datecopy.get_stop_date())
|
||||
|
||||
@ -1028,10 +1029,27 @@ class Date(object):
|
||||
else:
|
||||
pref = ""
|
||||
|
||||
if self.calendar != Date.CAL_GREGORIAN:
|
||||
cal = " (%s)" % Date.calendar_names[self.calendar]
|
||||
if self.newyear == Date.NEWYEAR_JAN1:
|
||||
ny = ""
|
||||
elif self.newyear == Date.NEWYEAR_MAR1:
|
||||
ny = "Mar1"
|
||||
elif self.newyear == Date.NEWYEAR_MAR25:
|
||||
ny = "Mar25"
|
||||
elif self.newyear == Date.NEWYEAR_SEP1:
|
||||
ny = "Sep1"
|
||||
else:
|
||||
cal = ""
|
||||
ny = "Err"
|
||||
|
||||
if self.calendar != Date.CAL_GREGORIAN:
|
||||
if ny:
|
||||
cal = " (%s,%s)" % (Date.calendar_names[self.calendar], ny)
|
||||
else:
|
||||
cal = " (%s)" % Date.calendar_names[self.calendar]
|
||||
else:
|
||||
if ny:
|
||||
cal = " (%s)" % ny
|
||||
else:
|
||||
cal = ""
|
||||
|
||||
if self.modifier == Date.MOD_TEXTONLY:
|
||||
val = self.text
|
||||
@ -1495,7 +1513,7 @@ class Date(object):
|
||||
"""
|
||||
Convert the date from the current calendar to the specified calendar.
|
||||
"""
|
||||
if calendar == self.calendar:
|
||||
if calendar == self.calendar and self.newyear == 0:
|
||||
return
|
||||
(year, month, day) = Date._calendar_change[calendar](self.sortval)
|
||||
if self.is_compound():
|
||||
|
Loading…
Reference in New Issue
Block a user