Fix for Swedish Midsummer Day.
svn: r14160
This commit is contained in:
parent
6b7f7c4684
commit
ec414b933c
@ -301,7 +301,7 @@
|
||||
<date name="2. Pääsiäispäivä" value="2010/4/5" type="religious" />
|
||||
<date name="2. Pääsiäispäivä" value="2011/4/25" type="religious" />
|
||||
<date name="2. Pääsiäispäivä" value="2012/4/9" type="religious" />
|
||||
<date name="2. Pääsiäispäivä" value="2013/4/1" type="religious" />
|
||||
<date name="2. Pääsiäispäivä" value="2013/4/1" type="religious" />easter
|
||||
<date name="2. Pääsiäispäivä" value="2014/4/21" type="religious" />
|
||||
<date name="2. Pääsiäispäivä" value="2015/4/6" type="religious" />
|
||||
<date name="Helatorstai" value="2000/6/1" type="religious" />
|
||||
@ -403,48 +403,18 @@
|
||||
<date name="début Kwanzaa" value="*/12/26" type="religious" />
|
||||
</country>
|
||||
<country name="Sverige - röda dagar">
|
||||
<date name="Nyårsdagen" value="*/1/1" type="National" />
|
||||
<date name="Trettondagen" value="*/1/5" type="National" />
|
||||
<date name="Långfredagen" value="2007/4/6" type="National" />
|
||||
<date name="Påskdagen" value="2007/4/8" type="National" />
|
||||
<date name="Annandag Påsk" value="2007/4/9" type="National" />
|
||||
<date name="Långfredagen" value="2008/3/21" type="National" />
|
||||
<date name="Påskdagen" value="2008/3/23" type="National" />
|
||||
<date name="Annandag Påsk" value="2008/3/24" type="National" />
|
||||
<date name="Långfredagen" value="2009/4/10" type="National" />
|
||||
<date name="Påskdagen" value="2009/4/12" type="National" />
|
||||
<date name="Annandag Påsk" value="2009/4/13" type="National" />
|
||||
<date name="Långfredagen" value="2010/4/2" type="National" />
|
||||
<date name="Påskdagen" value="2010/4/4" type="National" />
|
||||
<date name="Annandag Påsk" value="2010/4/5" type="National" />
|
||||
<date name="Långfredagen" value="2011/4/21" type="National" />
|
||||
<date name="Påskdagen" value="2011/4/24" type="National" />
|
||||
<date name="Annandag Påsk" value="2011/4/25" type="National" />
|
||||
<date name="Långfredagen" value="2012/4/6" type="National" />
|
||||
<date name="Påskdagen" value="2012/4/8" type="National" />
|
||||
<date name="Annandag Påsk" value="2012/4/9" type="National" />
|
||||
<date name="Långfredagen" value="2013/3/29" type="National" />
|
||||
<date name="Påskdagen" value="2013/3/31" type="National" />
|
||||
<date name="Annandag Påsk" value="2013/4/1" type="National" />
|
||||
<date name="Långfredagen" value="2014/4/18" type="National" />
|
||||
<date name="Påskdagen" value="2014/4/20" type="National" />
|
||||
<date name="Annandag Påsk" value="2014/4/21" type="National" />
|
||||
<date name="Långfredagen" value="2015/4/3" type="National" />
|
||||
<date name="Påskdagen" value="2015/4/5" type="National" />
|
||||
<date name="Annandag Påsk" value="2015/4/6" type="National" />
|
||||
<date name="Första Maj" value="*/5/1" type="National" />
|
||||
<date name="Kristi Himmelfärdsdag" value="2009/5/21" type="National" />
|
||||
<date name="Kristi Himmelfärdsdag" value="2010/5/13" type="National" />
|
||||
<date name="Kristi Himmelfärdsdag" value="2011/6/2" type="National" />
|
||||
<date name="Kristi Himmelfärdsdag" value="2012/5/17" type="National" />
|
||||
<date name="Kristi Himmelfärdsdag" value="2013/5/9" type="National" />
|
||||
<date name="Kristi Himmelfärdsdag" value="2014/5/29" type="National" />
|
||||
<date name="Kristi Himmelfärdsdag" value="2015/5/14" type="National" />
|
||||
<date name="Nationaldag" value="*/6/6" type="National" />
|
||||
<date name="Midsommardagen" value="*/3/sat/jun" type="National" />
|
||||
<date name="Allahelgonadagen" value="*/1/sat/nov" type="National" />
|
||||
<date name="Juldagen" value="*/12/25" type="National" />
|
||||
<date name="Annandag Jul" value="*/12/26" type="National" />
|
||||
<date name="Nyårsdagen" value="*/1/1" type="religious" />
|
||||
<date name="Trettondagen" value="*/1/6" type="religious" />
|
||||
<date name="Långfredagen" type="religious" value="> easter(y)" offset="-2" />
|
||||
<date name="Påskdagen" type="religious" value="> easter(y)" />
|
||||
<date name="Annandag Påsk" type="religious" value="> easter(y)" offset="2" />
|
||||
<date name="Första Maj" value="*/5/1" type="secular" />
|
||||
<date name="Kristi Himmelfärdsdag" type="religious" value="> easter(y)" offset="+39" />
|
||||
<date name="Nationaldag" value="*/6/6" type="secular" />
|
||||
<date name="Midsommardagen" value="> swedish_midsummer_day(y)" type="religious" />
|
||||
<date name="Allahelgonadagen" value="*/1/sat/nov" type="religious" />
|
||||
<date name="Juldagen" value="*/12/25" type="religious" />
|
||||
<date name="Annandag Jul" value="*/12/26" type="religious" />
|
||||
</country>
|
||||
<country name="England">
|
||||
<date name="New Year's Day" value="2010/1/1" type="National" />
|
||||
|
@ -87,6 +87,21 @@ def dst(year, area="us"):
|
||||
stop = "%d/%d/%d" % (year, 10, (31 - (math.floor(year * 5 / 4) + 1) % 7)) # Oct
|
||||
return (start, stop)
|
||||
|
||||
def swedish_midsummer_day(year):
|
||||
"""
|
||||
Function for calculating date for Swedish Midsummer Day
|
||||
It is Saturday in week number 25, which is the third or
|
||||
forth Saturday in June.
|
||||
First possible date for third Saturday is June, 15
|
||||
Last possible date for fourth Saturday is June, 28
|
||||
In holidays.xml it is called by
|
||||
<date name="Midsommardagen" value="> swedish_midsummer_day(y)" type="religious" />
|
||||
"""
|
||||
for day in range(15,29):
|
||||
d = datetime.date(year, 6, day)
|
||||
if (year, 25, 6) == d.isocalendar():
|
||||
return str(year) + "/6/" + str(day)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# HolidayTable
|
||||
@ -358,7 +373,6 @@ class _Holidays:
|
||||
|
||||
if self.debug:
|
||||
print "rule['value']:", rule["value"]
|
||||
|
||||
if rule["value"].count("/") == 3: # year/num/day/month, "3rd wednesday in april"
|
||||
y, num, dayname, mon = rule["value"].split("/")
|
||||
if y == "*":
|
||||
|
Loading…
Reference in New Issue
Block a user