Class: When::CalendarNote::JapaneseSolarNote

Inherits:
When::CalendarNote show all
Defined in:
lib/when_exe/region/japanese/notes.rb

Overview

太陽暦の暦注・祝祭日

Constant Summary collapse

NotesList =

祝祭日一覧

{
  [ 1, 1] => [[1868..1872, When.M17n('JapaneseHoliday::元旦')], [1874..1948, When.M17n('JapaneseHoliday::四方拝')],
              [1949..2100, When.M17n('JapaneseHoliday::元日')]],
  [ 1, 3] => [[1874..1948, When.M17n('JapaneseHoliday::元始祭')]],
  [ 1, 5] => [[1874..1948, When.M17n('JapaneseHoliday::新年宴会')]],
  [ 1,-2] => [[2000..2100, When.M17n('JapaneseHoliday::成人の日')]],
  [ 1,15] => [[1868..1872, When.M17n('JapaneseHoliday::小正月')], [1949..1999, When.M17n('JapaneseHoliday::成人の日')]],
  [ 1,29] => [[1873..1873, When.M17n('JapaneseHoliday::神武天皇即位日')]],
  [ 1,30] => [[1874..1912, When.M17n('JapaneseHoliday::孝明天皇祭')]],
  [ 2,11] => [[1874..1948, When.M17n('JapaneseHoliday::紀元節')], [1967..2100, When.M17n('JapaneseHoliday::建国記念の日')]],
  [ 2,23] => [[2020..2100, When.M17n('JapaneseHoliday::天皇誕生日')]],
  [ 2,24] => [[1989..1989, When.M17n('JapaneseHoliday::昭和天皇の大喪の礼')]],
  [ 3, 3] => [[1868..1872, When.M17n('JapaneseHoliday::弥生節句')]],
  [ 3, 0] => [[1879..1948, When.M17n('JapaneseHoliday::春季皇霊祭')], [1949..2100, When.M17n('JapaneseHoliday::春分の日')]],
  [ 4, 3] => [[1874..1948, When.M17n('JapaneseHoliday::神武天皇祭')]],
  [ 4,10] => [[1959..1959, When.M17n('JapaneseHoliday::皇太子明仁親王の結婚の儀')]],
  [ 4,29] => [[1927..1948, When.M17n('JapaneseHoliday::天長節')], [1949..1988, When.M17n('JapaneseHoliday::天皇誕生日')],
              [1989..2006, When.M17n('JapaneseHoliday::みどりの日')], [2007..2100, When.M17n('JapaneseHoliday::昭和の日')]],
  [ 5, 1] => [[2019..2019, When.M17n('JapaneseHoliday::即位の日')]],
  [ 5, 3] => [[1949..2100, When.M17n('JapaneseHoliday::憲法記念日')]],
  [ 5, 4] => [[2007..2100, When.M17n('JapaneseHoliday::みどりの日')]],
  [ 5, 5] => [[1868..1872, When.M17n('JapaneseHoliday::端午節句')], [1949..2100, When.M17n('JapaneseHoliday::こどもの日')]],
  [ 6, 9] => [[1993..1993, When.M17n('JapaneseHoliday::皇太子徳仁親王の結婚の儀')]],
  [ 7, 7] => [[1868..1872, When.M17n('JapaneseHoliday::七夕節句')]],
  [ 7,15] => [[1868..1872, When.M17n('JapaneseHoliday::お盆')]],
  [ 7,20] => [[1996..2002, When.M17n('JapaneseHoliday::海の日')]],
  [ 7,22] => [[2021..2021, When.M17n('JapaneseHoliday::海の日')]],
  [ 7,23] => [[2020..2020, When.M17n('JapaneseHoliday::海の日')],[2021..2021, When.M17n('JapaneseHoliday::スポーツの日')]],
  [ 7,-3] => [[2003..2019, When.M17n('JapaneseHoliday::海の日')],[2022..2100, When.M17n('JapaneseHoliday::海の日')]],
  [ 7,24] => [[2020..2020, When.M17n('JapaneseHoliday::スポーツの日')]],
  [ 7,30] => [[1913..1926, When.M17n('JapaneseHoliday::明治天皇祭')]],
  [ 8, 1] => [[1868..1872, When.M17n('JapaneseHoliday::田実節句')]],
  [ 8, 8] => [[2021..2021, When.M17n('JapaneseHoliday::山の日')]],
  [ 8,10] => [[2020..2020, When.M17n('JapaneseHoliday::山の日')]],
  [ 8,11] => [[2016..2019, When.M17n('JapaneseHoliday::山の日')],[2022..2100, When.M17n('JapaneseHoliday::山の日')]],
  [ 8,31] => [[1913..1926, When.M17n('JapaneseHoliday::天長節')]],
  [ 9, 9] => [[1868..1872, When.M17n('JapaneseHoliday::重陽節句')]],
  [ 9,15] => [[1966..2002, When.M17n('JapaneseHoliday::敬老の日')]],
  [ 9,-3] => [[2003..2100, When.M17n('JapaneseHoliday::敬老の日')]],
  [ 9,17] => [[1874..1878, When.M17n('JapaneseHoliday::神嘗祭')]],
  [ 9, 0] => [[1878..1947, When.M17n('JapaneseHoliday::秋季皇霊祭')], [1948..2100, When.M17n('JapaneseHoliday::秋分の日')]],
  [10, 2] => [[1929..1929, When.M17n('JapaneseHoliday::皇大神宮遷御当日')]],
  [10,10] => [[1966..1999, When.M17n('JapaneseHoliday::体育の日')]],
  [10,-2] => [[2000..2019, When.M17n('JapaneseHoliday::体育の日')],[2022..2100, When.M17n('JapaneseHoliday::スポーツの日')]],
  [10,17] => [[1879..1947, When.M17n('JapaneseHoliday::神嘗祭')]],
  [10,22] => [[2019..2019, When.M17n('JapaneseHoliday::即位礼正殿の儀')]],
  [10,31] => [[1913..1926, When.M17n('JapaneseHoliday::天長節祝日')]],
  [11, 3] => [[1873..1911, When.M17n('JapaneseHoliday::天長節')], [1927..1947, When.M17n('JapaneseHoliday::明治節')],
              [1948..2100, When.M17n('JapaneseHoliday::文化の日')]],
  [11,10] => [[1915..1915, When.M17n('JapaneseHoliday::即位の礼')], [1928..1928, When.M17n('JapaneseHoliday::即位の礼')]],
  [11,12] => [[1990..1990, When.M17n('JapaneseHoliday::即位礼正殿の儀')]],
  [11,14] => [[1915..1915, When.M17n('JapaneseHoliday::大嘗祭')], [1928..1928, When.M17n('JapaneseHoliday::大嘗祭')]],
  [11,16] => [[1915..1915, When.M17n('JapaneseHoliday::大饗第1日')], [1928..1928, When.M17n('JapaneseHoliday::大饗第1日')]],
  [11,23] => [[1873..1947, When.M17n('JapaneseHoliday::新嘗祭')], [1948..2100, When.M17n('JapaneseHoliday::勤労感謝の日')]],
  [12,23] => [[1989..2018, When.M17n('JapaneseHoliday::天皇誕生日')]],
  [12,25] => [[1927..1947, When.M17n('JapaneseHoliday::大正天皇祭')]]
}
Long =
{3=>0, 9=>180}

Constants inherited from When::CalendarNote

Bahai, CalendarDepend, Chinese, CommonWithRokuyo, CommonWithSovietFiveDay, CommonWithSovietSixDay, Default, HashProperty, Javanese, JulianDay, Mayan, Tibetan, Yis

Constants included from Parts::Resource

Parts::Resource::ConstList, Parts::Resource::ConstTypes, Parts::Resource::IRIDecode, Parts::Resource::IRIDecodeTable, Parts::Resource::IRIEncode, Parts::Resource::IRIEncodeTable, Parts::Resource::IRIHeader, Parts::Resource::LabelProperty

Constants included from Namespace

Namespace::DC, Namespace::DCQ, Namespace::DCT, Namespace::FOAF, Namespace::OWL, Namespace::RDF, Namespace::RDFC, Namespace::RDFS, Namespace::RSS, Namespace::XSD

Instance Attribute Summary

Attributes inherited from When::CalendarNote

#event

Attributes inherited from TM::ReferenceSystem

#domain_of_validity, #position

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#_pool, #child, #keys, #locale, #namespace

Class Method Summary collapse

Methods inherited from When::CalendarNote

#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes, #year

Methods inherited from TM::ReferenceSystem

#domain, #name

Methods included from Parts::Resource

#[], #^, _abbreviation_to_iri, _decode, _encode, _extract_prefix, _instance, _instantiate, _parse, _path_with_prefix, _replace_tags, _setup_, _setup_info, _simplify_path, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #parent, #registered?, root_dir

Methods included from Parts::Resource::Pool

#[], #[]=, #_pool, #_setup_, #pool_keys

Methods included from Parts::Resource::Synchronize

#synchronize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Parts::Resource

Class Method Details

._day_notes(notes, dates, conditions = {}) ⇒ Object

日の暦注 - 祝祭日の計算



856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
# File 'lib/when_exe/region/japanese/notes.rb', line 856

def _day_notes(notes, dates, conditions={})
  # 明治維新以降の実暦日のみ扱う
  return notes if dates.o_date.frame.kind_of?(When::CalendarTypes::ChineseLuniSolar)
  year = dates.o_date.most_significant_coordinate
  return notes unless year >= 1868

  # 春分の日と秋分の日を祝祭日に加える
  long = Long[dates.o_date.cal_date[1]] if year >= 1878
  if long
    date = When.when?(dates.o_date.to_cal_date.to_s,
             {:frame=>dates.o_date.frame,
              :clock=>dates.s_date.frame.time_basis})
    term = dates.cal4note.s_terms.term(date.floor(When::MONTH,
                                                  When::DAY), [long,360]).cal_date[1..2]
    list = NotesList.dup
    list[term] = list[[term[0],0]]
  else
    list = NotesList
  end

  # 「国民の休日」制定以前
  notes['祝祭日'] ||= _holiday(list, dates.o_date, When.M17n('JapaneseHoliday::振替休日'))
  return notes if notes['祝祭日'] || year < 1988

  # 「国民の休日」制定以後
  duration = When.Duration('P1D')
  [duration, -duration].each do |d|
    return notes unless _holiday(list, dates.o_date + d)
  end
  notes['祝祭日'] = When.M17n('JapaneseHoliday::国民の休日')
  return notes
end