Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added midsummer eve proper way

  • Loading branch information...
commit 590c52f34b9d3d946b3d13fe334aa17399160bef 1 parent 2ad459a
@hasanen hasanen authored hahahana committed
Showing with 15 additions and 13 deletions.
  1. +14 −0 data/fi.yaml
  2. +1 −13 lib/holidays/fi.rb
View
14 data/fi.yaml
@@ -38,6 +38,9 @@ months:
regions: [fi]
mday: 1
6:
+ - name: Juhannusaatto
+ regions: [fi]
+ function: fi_juhannusaatto(year)
- name: Juhannuspäivä
regions: [fi]
function: fi_juhannuspaiva(year)
@@ -56,6 +59,17 @@ months:
regions: [fi]
mday: 26
methods:
+ fi_juhannusaatto: |
+ # Finland: Mid-summer eve (Friday between June 19–25)
+ def self.fi_juhannusaatto(year)
+ date = Date.civil(year,6,19)
+ if date.wday > 5 #if 19.6 is saturday
+ date += 6
+ else
+ date += (5 - date.wday)
+ end
+ date
+ end
fi_juhannuspaiva: |
# Finland: Mid-summer (Saturday between June 20–26)
def self.fi_juhannuspaiva(year)
View
14 lib/holidays/fi.rb
@@ -27,8 +27,7 @@ def self.holidays_by_month
1 => [{:mday => 1, :name => "Uudenvuodenpäivä", :regions => [:fi]},
{:mday => 6, :name => "Loppiainen", :regions => [:fi]}],
5 => [{:mday => 1, :name => "Vappu", :regions => [:fi]}],
- 6 => [{:function => lambda { |year| Holidays.fi_juhannuspaiva(year) }, :function_id => "fi_juhannuspaiva(year)", :name => "Juhannuspäivä", :regions => [:fi]},
- {:function => lambda { |year| Holidays.fi_juhannusaatto(year) }, :function_id => "fi_juhannusaatto(year)", :name => "Juhannusaatto", :regions => [:fi]}],
+ 6 => [{:function => lambda { |year| Holidays.fi_juhannuspaiva(year) }, :function_id => "fi_juhannuspaiva(year)", :name => "Juhannuspäivä", :regions => [:fi]}],
12 => [{:mday => 6, :name => "Itsenäisyyspäivä", :regions => [:fi]},
{:mday => 24, :name => "Jouluaatto", :regions => [:fi]},
{:mday => 25, :name => "Joulupäivä", :regions => [:fi]},
@@ -37,17 +36,6 @@ def self.holidays_by_month
end
end
-# Finland: Mid-summer eve (Friday between June 19–25)
-def self.fi_juhannusaatto(year)
- date = Date.civil(year,6,19)
- if date.wday > 5 #if 19.6 is saturday
- date += 6
- else
- date += (5 - date.wday)
- end
- date
-end
-
# Finland: Mid-summer (Saturday between June 20–26)
def self.fi_juhannuspaiva(year)
date = Date.civil(year,6,20)
Please sign in to comment.
Something went wrong with that request. Please try again.