def format_date(date): """ Format the date """ start = date.get_start_date() if start != Date.EMPTY: cal = date.get_calendar() mod = date.get_modifier() quality = date.get_quality() if quality in DATE_QUALITY: qual_text = DATE_QUALITY[quality] + " " else: qual_text = "" if mod == Date.MOD_SPAN: val = "%sFROM %s TO %s" % ( qual_text, make_gedcom_date(start, cal, mod, None), make_gedcom_date(date.get_stop_date(), cal, mod, None)) elif mod == Date.MOD_RANGE: val = "%sBET %s AND %s" % ( qual_text, make_gedcom_date(start, cal, mod, None), make_gedcom_date(date.get_stop_date(), cal, mod, None)) else: val = make_gedcom_date(start, cal, mod, quality) return val return ""