Class: When::CalendarTypes::CalendarNote::JapaneseSolarNote

Inherits:
When::CalendarTypes::CalendarNote show all
Defined in:
lib/when_exe/region/japanese_notes.rb

Overview

太陽暦の暦注・祝祭日

Constant Summary collapse

NotesList =

祝祭日一覧

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

Constants inherited from When::CalendarTypes::CalendarNote

BahaiNotes, ChineseNotes, DefaultNotes, JavaneseNotes, JulianDayNotes, MayanNotes, TibetanNotes, YiNotes

Constants included from Parts::Resource

Parts::Resource::LabelProperty

Instance Attribute Summary

Attributes inherited from When::CalendarTypes::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::CalendarTypes::CalendarNote

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

Methods inherited from TM::ReferenceSystem

#domain, #name

Methods included from Parts::Resource

#[], #^, _decode, _encode, _extract_prefix, _instance, _parse, _path_with_prefix, _replace_tags, _setup_, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?

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

日の暦注 - 祝祭日の計算



760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
# File 'lib/when_exe/region/japanese_notes.rb', line 760

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, '振替休日')
  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['祝祭日'] = '国民の休日'
  return notes
end