Class: When::CalendarTypes::CalendarNote::JapaneseSolarNote
- Inherits:
-
When::CalendarTypes::CalendarNote
- Object
- BasicTypes::Object
- TM::Object
- TM::ReferenceSystem
- When::CalendarTypes::CalendarNote
- When::CalendarTypes::CalendarNote::JapaneseSolarNote
- 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, '建国記念の日']], [ 3, 3] => [[1868..1872, '弥生節句']], [ 3, 0] => [[1879..1948, '春季皇霊祭'], [1949..2100, '春分の日']], [ 4, 3] => [[1874..1948, '神武天皇祭']], [ 4,29] => [[1927..1948, '天長節'], [1949..1988, '天皇誕生日'], [1989..2006, 'みどりの日'], [2007..2100, '昭和の日']], [ 5, 3] => [[1949..2100, '憲法記念日']], [ 5, 4] => [[2007..2100, 'みどりの日']], [ 5, 5] => [[1868..1872, '端午節句'], [1949..2100, 'こどもの日']], [ 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,23] => [[1873..1947, '新嘗祭'], [1948..2100, '勤労感謝の日']], [12,23] => [[1989..2100, '天皇誕生日']], [12,25] => [[1927..1947, '大正天皇祭']] }
Constants inherited from When::CalendarTypes::CalendarNote
BahaiNotes, ChineseNotes, DefaultNotes, JavaneseNotes, JulianDayNotes, MayanNotes, YiNotes
Constants included from Parts::Resource
Parts::Resource::LabelProperty, Parts::Resource::Prefix, Parts::Resource::PrefixIndex, Parts::Resource::PrefixKeys, Parts::Resource::PrefixValues
Instance Attribute Summary
Attributes inherited from When::CalendarTypes::CalendarNote
Attributes inherited from TM::ReferenceSystem
#domain, #domain_of_validity, #position
Attributes inherited from BasicTypes::Object
Attributes included from Parts::Resource
#_pool, #child, #keys, #locale, #namespace
Class Method Summary collapse
-
._day_notes(notes, dates, conditions = {}) ⇒ Object
日の暦注 - 祝祭日の計算.
Methods inherited from When::CalendarTypes::CalendarNote
#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes, #year
Methods inherited from TM::ReferenceSystem
Methods inherited from BasicTypes::Object
Methods included from Parts::Resource
#[], #^, _extract_prefix, _instance, _parse, _path_with_prefix, #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
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
日の暦注 - 祝祭日の計算
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
# File 'lib/when_exe/region/japanese_notes.rb', line 533 def _day_notes(notes, dates, conditions={}) # 明治維新以降のみ扱う year = dates.o_date.most_significant_coordinate return notes unless year >= 1868 # 春分の日と秋分の日を祝祭日に加える long = {3=>0, 9=>180}[dates.o_date.cal_date[1]] if year >= 1878 if long date = When.when?(dates.o_date.to_cal_date.to_s, {:clock=>When.Clock(dates.s_date.frame.timezone[0]*86400)}) term = dates.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 |