diff --git a/src/gen/lib/date.py b/src/gen/lib/date.py index cbc669ded..1ed8d66c5 100644 --- a/src/gen/lib/date.py +++ b/src/gen/lib/date.py @@ -1863,3 +1863,10 @@ def lookup_calendar(calendar): return pos raise AttributeError("invalid calendar: '%s'" % calendar) +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 + diff --git a/src/plugins/textreport/BirthdayReport.py b/src/plugins/textreport/BirthdayReport.py index 878defcbb..e31a612b1 100644 --- a/src/plugins/textreport/BirthdayReport.py +++ b/src/plugins/textreport/BirthdayReport.py @@ -40,6 +40,7 @@ import datetime, time from gen.display.name import displayer as global_name_display from Errors import ReportError from gen.lib import NameType, EventType, Name, Date, Person, Surname +from gen.lib.date import gregorian import Relationship from gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle, FONT_SERIF, PARA_ALIGN_RIGHT, @@ -232,6 +233,8 @@ class CalendarReport(Report): birth_date = birth_event.get_date_object() if (self.birthdays and birth_date is not None and birth_date.is_valid()): + birth_date = gregorian(birth_date) + year = birth_date.get_year() month = birth_date.get_month() day = birth_date.get_day() @@ -316,6 +319,8 @@ class CalendarReport(Report): for event_ref in fam.get_event_ref_list(): event = self.database.get_event_from_handle(event_ref.ref) event_obj = event.get_date_object() + if event_obj is not Date.EMPTY and event_obj.is_valid(): + event_obj = gregorian(event_obj) year = event_obj.get_year() month = event_obj.get_month() day = event_obj.get_day() diff --git a/src/plugins/webreport/WebCal.py b/src/plugins/webreport/WebCal.py index ff6828b95..30dd2a9a8 100644 --- a/src/plugins/webreport/WebCal.py +++ b/src/plugins/webreport/WebCal.py @@ -69,6 +69,8 @@ from libhtml import Html from libhtmlconst import _CHARACTER_SETS, _CC, _COPY_OPTIONS from gui.pluginmanager import GuiPluginManager +from gen.lib.date import gregorian + # import styled notes from # src/plugins/lib/libhtmlbackend.py from libhtmlbackend import HtmlBackend @@ -1713,11 +1715,3 @@ 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() != gen.lib.Date.CAL_GREGORIAN: - date = gen.lib.Date(date) - date.convert_calendar(gen.lib.Date.CAL_GREGORIAN) - return date -