Module: Holidays::Definition::CustomMethods::CH

Defined in:
lib/holidays/definition/custom_methods/ch.rb

Overview

ch custom holiday calculations, ported verbatim from the methods: block in definitions/ch.yaml.

Class Method Summary collapse

Class Method Details

.ch_be_zibelemaerit(year) ⇒ Object



44
45
46
47
48
49
50
51
52
53
# File 'lib/holidays/definition/custom_methods/ch.rb', line 44

def ch_be_zibelemaerit(year)
  date = Date.civil(year,11,1)
  # Find the first Monday of November
  until date.wday.eql? 1 do
    date += 1
  end
  # There are 21 days between the first monday
  # and the 4rth Monday after
  date + 21
end

.ch_ge_jeune_genevois(year) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/holidays/definition/custom_methods/ch.rb', line 21

def ch_ge_jeune_genevois(year)
  date = Date.civil(year,9,1)
  # Find the first Sunday of September
  until date.wday.eql? 0 do
    date += 1
  end
  # Thursday is four days after Sunday
  date + 4
end

.ch_gl_naefelser_fahrt(year) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/holidays/definition/custom_methods/ch.rb', line 31

def ch_gl_naefelser_fahrt(year)
  date = Date.civil(year,4,1)
  # Find the first Thursday of April
  until date.wday.eql? 4 do
    date += 1
  end

  if date.eql?(Holidays::Factory::DateCalculator::Easter::Gregorian.easter_calculator.calculate_easter_for(year)-3)
    date += 7
  end
  date
end

.ch_vd_lundi_du_jeune_federal(year) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/holidays/definition/custom_methods/ch.rb', line 10

def ch_vd_lundi_du_jeune_federal(year)
  date = Date.civil(year,9,1)
  # Find the first Sunday of September
  until date.wday.eql? 0 do
    date += 1
  end
  # There are 15 days between the first Sunday
  # and the Monday after the third Sunday
  date + 15
end