Add Brazilian holiday defs

This commit is contained in:
Alex Dunae 2011-04-29 14:41:16 -07:00
parent 334d9034cd
commit 61d90c32d0
2 changed files with 75 additions and 0 deletions

74
data/br.yaml Normal file
View file

@ -0,0 +1,74 @@
# Brazilian holiday definitions for the Ruby Holiday gem.
# Provided by Rogério Carrasqueira
#
# Updated: 2008-11-28.
# Sources:
# - http://pt.wikipedia.org/wiki/Feriados_no_Brasil
---
months:
0:
- name: Carnaval # same as Shrove Tuesday
regions: [br]
function: easter(year)-47
type: informal
- name: Sexta-feira Santa
regions: [br]
function: easter(year)-2
- name: Páscoa
regions: [br]
function: easter(year)
- name: Corpus Christ
regions: [br]
function: easter(year)+60
1:
- name: Dia da Confraternização Universal
regions: [br]
mday: 1
4:
- name: Dia de Tiradentes
regions: [br]
mday: 21
5:
- name: Dia do Trabalho
regions: [br]
mday: 1
9:
- name: Proclamação da Independência
regions: [br]
mday: 7
10:
- name: Dia de Nossa Senhora Aparecida
regions: [br]
mday: 12
11:
- name: Dia de Finados
regions: [br]
mday: 2
- name: Proclamação da República
regions: [br]
mday: 15
12:
- name: Natal
regions: [br]
mday: 25
tests: |
{Date.civil(2008,1,1) => 'Dia da Confraternização Universal',
Date.civil(2005,2,8) => 'Carnaval',
Date.civil(2006,2,28) => 'Carnaval',
Date.civil(2007,2,20) => 'Carnaval',
Date.civil(2008,2,5) => 'Carnaval',
Date.civil(2008,3,21) => 'Sexta-feira Santa',
Date.civil(2008,3,23) => 'Páscoa',
Date.civil(2008,4,21) => 'Dia de Tiradentes',
Date.civil(2008,5,1) => 'Dia do Trabalho',
Date.civil(2005,5,26) => 'Corpus Christ',
Date.civil(2007,6,7) => 'Corpus Christ',
Date.civil(2008,5,22) => 'Corpus Christ',
Date.civil(2008,9,7) => 'Proclamação da Independência',
Date.civil(2008,10,12) => 'Dia de Nossa Senhora Aparecida',
Date.civil(2008,11,2) => 'Dia de Finados',
Date.civil(2008,11,15) => 'Proclamação da República',
Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
assert_equal name, (Holidays.on(date, :br, :informal)[0] || {})[:name]
end

View file

@ -2,6 +2,7 @@
---
defs:
AU: ['au.yaml']
BR: ['br.yaml']
CA: ['ca.yaml', 'north_america_informal.yaml']
CZ: ['cz.yaml']
DK: ['dk.yaml']