From 08dc8ffc530bd24b6b7de73b1ea089853c1f3262 Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Thu, 26 Sep 2013 22:06:15 +0000 Subject: [PATCH] 7089: webcal mistreats non-gregorian event dates svn: r23209 --- gramps/plugins/webreport/webcal.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gramps/plugins/webreport/webcal.py b/gramps/plugins/webreport/webcal.py index 1a72caa96..ecf2773fe 100644 --- a/gramps/plugins/webreport/webcal.py +++ b/gramps/plugins/webreport/webcal.py @@ -577,7 +577,7 @@ class WebCalReport(Report): elif url_fname == 'fullyearlinked': myTitle = _('Full year at a Glance') else: - myTitle = _(url_fname) + myTitle = _(url_fname) hyper = Html("a", nav_text, href = url, name = url_fname, title = myTitle) if check_cs: @@ -1099,6 +1099,7 @@ class WebCalReport(Report): # determine birthday information??? if (self.birthday and birth_date is not Date.EMPTY and birth_date.is_valid()): + birth_date = gregorian(birth_date) year = birth_date.get_year() or this_year month = birth_date.get_month() @@ -1162,6 +1163,7 @@ class WebCalReport(Report): if marriage_event: event_date = marriage_event.get_date_object() if event_date is not Date.EMPTY and event_date.is_valid(): + event_date = gregorian(event_date) year = event_date.get_year() month = event_date.get_month() day = event_date.get_day() @@ -1725,3 +1727,10 @@ def get_day_list(event_date, holiday_list, bday_anniv_list): # return to its caller calendar_build() return day_list + +def gregorian(date): + """Convert given date to gregorian. Doesn't modify the original object.""" + if date.get_calendar() != Date.CAL_GREGORIAN: + date = Date(date) + date.convert_calendar(Date.CAL_GREGORIAN) + return date