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:
Doug Blank 2009-10-22 04:15:18 +00:00
parent 0802b891df
commit c202f43e9b

View File

@ -913,6 +913,7 @@ class Date(object):
datecopy = Date(self) datecopy = Date(self)
#we do all calculation in Gregorian calendar #we do all calculation in Gregorian calendar
datecopy.convert_calendar(Date.CAL_GREGORIAN) datecopy.convert_calendar(Date.CAL_GREGORIAN)
start = yr_mon_day(datecopy.get_start_date()) start = yr_mon_day(datecopy.get_start_date())
stop = yr_mon_day(datecopy.get_stop_date()) stop = yr_mon_day(datecopy.get_stop_date())
@ -1028,8 +1029,25 @@ class Date(object):
else: else:
pref = "" pref = ""
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:
ny = "Err"
if self.calendar != Date.CAL_GREGORIAN: 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] cal = " (%s)" % Date.calendar_names[self.calendar]
else:
if ny:
cal = " (%s)" % ny
else: else:
cal = "" cal = ""
@ -1495,7 +1513,7 @@ class Date(object):
""" """
Convert the date from the current calendar to the specified calendar. Convert the date from the current calendar to the specified calendar.
""" """
if calendar == self.calendar: if calendar == self.calendar and self.newyear == 0:
return return
(year, month, day) = Date._calendar_change[calendar](self.sortval) (year, month, day) = Date._calendar_change[calendar](self.sortval)
if self.is_compound(): if self.is_compound():