From 4434fd654263cc105ecbb0eaad811c55ea7926b3 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 6 Dec 2009 17:34:27 +0000 Subject: [PATCH] Added convienience method for getting year in the calendar of a date svn: r13731 --- src/gen/lib/date.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gen/lib/date.py b/src/gen/lib/date.py index 0fe6a6c28..8aaf03270 100644 --- a/src/gen/lib/date.py +++ b/src/gen/lib/date.py @@ -1231,6 +1231,16 @@ class Date(object): """ return self._get_low_item(Date._POS_YR) + def get_year_calendar(self, calendar=None): + """ + Return the year of this date in the calendar given. + + Defaults to self.calendar if one is not given. + """ + if not calendar: + calendar = self.calendar + return self.to_calendar(calendar).get_year() + def get_new_year(self): """ Return the new year code associated with the date.