From e3557e30083b25a43599d735dcc6a95ffd87b697 Mon Sep 17 00:00:00 2001 From: Peter Landgren Date: Thu, 17 Feb 2011 08:36:40 +0000 Subject: [PATCH] Improved Swedish Calendar. svn: r16643 --- src/gen/lib/calendar.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gen/lib/calendar.py b/src/gen/lib/calendar.py index 8dcb1d269..d0ebe9a13 100644 --- a/src/gen/lib/calendar.py +++ b/src/gen/lib/calendar.py @@ -551,10 +551,16 @@ def islamic_ymd(sdn): def swedish_sdn(year, month, day): """Convert a Swedish (almost Julian) date to an SDN number.""" - return julian_sdn(year, month, day)-1 + datum = (year, month, day) + if datum >= (1700,3,1) and datum <= (1712,2,30): + return julian_sdn(year, month, day) -1 + return julian_sdn(year, month, day) def swedish_ymd(sdn): """Convert an SDN number to a Swedish (almost Julian) calendar date.""" if sdn == 2346425: return (1712,2,30) + # Return Julian outside Swedish Calendar + if sdn <= 2342042 or sdn > 2346425: + return julian_ymd(sdn) return julian_ymd(sdn+1)