holidays/data/fi.yaml

95 lines
2.6 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Finnish holiday definitions for the Ruby Holiday gem.
#
# Updated: 2010-12-28.
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Finland
---
months:
0:
- name: Pitkäperjantai
regions: [fi]
function: easter(year)-2
- name: Pääsiäispäivä
regions: [fi]
function: easter(year)
- name: 2. Pääsiäispäivä
regions: [fi]
function: easter(year)+1
- name: Helatorstai # Ascension Day
regions: [fi]
function: easter(year)+39
- name: Helluntaipäivä # Whitsunday
regions: [fi]
function: easter(year)+49
- name: Pyhäinpäivä # All Saint's Day
regions: [fi]
function: fi_pyhainpaiva(year)
1:
- name: Uudenvuodenpäivä
regions: [fi]
mday: 1
- name: Loppiainen
regions: [fi]
mday: 6
5:
- name: Vappu
regions: [fi]
mday: 1
6:
- name: Juhannuspäivä
regions: [fi]
function: fi_juhannuspaiva(year)
12:
- name: Itsenäisyyspäivä
regions: [fi]
mday: 6
- name: Jouluaatto
regions: [fi]
mday: 24
- name: Joulupäivä
regions: [fi]
mday: 25
- name: Tapaninpäivä
regions: [fi]
mday: 26
methods:
fi_juhannuspaiva: |
# Finland: Mid-summer (Saturday between June 2026)
def self.fi_juhannuspaiva(year)
date = Date.civil(year,6,20)
date += (6 - date.wday)
date
end
fi_pyhainpaiva: |
# Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
def self.fi_pyhainpaiva(year)
date = Date.civil(year,10,31)
date += (6 - date.wday)
date
end
tests: |
{Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
Date.civil(2008,1,6) => 'Loppiainen',
Date.civil(2008,3,21) => 'Pitkäperjantai',
Date.civil(2008,3,23) => 'Pääsiäispäivä',
Date.civil(2008,3,24) => '2. Pääsiäispäivä',
Date.civil(2008,5,1) => 'Vappu',
Date.civil(2008,5,1) => 'Helatorstai',
Date.civil(2008,5,11) => 'Helluntaipäivä',
Date.civil(2005,6,25) => 'Juhannuspäivä',
Date.civil(2006,6,24) => 'Juhannuspäivä',
Date.civil(2007,6,23) => 'Juhannuspäivä',
Date.civil(2008,6,21) => 'Juhannuspäivä',
Date.civil(2005,11,5) => 'Pyhäinpäivä',
Date.civil(2006,11,4) => 'Pyhäinpäivä',
Date.civil(2007,11,3) => 'Pyhäinpäivä',
Date.civil(2008,11,1) => 'Pyhäinpäivä',
Date.civil(2008,12,6) => 'Itsenäisyyspäivä',
Date.civil(2008,12,24) => 'Jouluaatto',
Date.civil(2008,12,25) => 'Joulupäivä',
Date.civil(2008,12,26) => 'Tapaninpäivä'}.each do |date, name|
assert_equal name, (Holidays.on(date, :fi, :informal)[0] || {})[:name]
end