when_exe 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +210 -171
- data/bin/irb.rc +1 -0
- data/lib/when_exe.rb +78 -53
- data/lib/when_exe/basictypes.rb +27 -8
- data/lib/when_exe/calendarnote.rb +848 -805
- data/lib/when_exe/calendartypes.rb +110 -240
- data/lib/when_exe/coordinates.rb +2440 -2175
- data/lib/when_exe/core/compatibility.rb +1 -1
- data/lib/when_exe/core/duration.rb +13 -11
- data/lib/when_exe/core/extension.rb +38 -45
- data/lib/when_exe/ephemeris.rb +43 -14
- data/lib/when_exe/ephemeris/eclipse.rb +149 -0
- data/lib/when_exe/ephemeris/notes.rb +39 -7
- data/lib/when_exe/icalendar.rb +2 -6
- data/lib/when_exe/inspect.rb +1408 -1399
- data/lib/when_exe/parts/enumerator.rb +486 -477
- data/lib/when_exe/parts/resource.rb +1101 -1069
- data/lib/when_exe/parts/timezone.rb +6 -5
- data/lib/when_exe/region/babylonian.rb +405 -405
- data/lib/when_exe/region/bahai.rb +21 -61
- data/lib/when_exe/region/chinese/epochs.rb +81 -81
- data/lib/when_exe/region/chinese/twins.rb +51 -51
- data/lib/when_exe/region/christian.rb +7 -2
- data/lib/when_exe/region/coptic.rb +1 -1
- data/lib/when_exe/region/discordian.rb +9 -16
- data/lib/when_exe/region/french.rb +1 -1
- data/lib/when_exe/region/hanke_henry.rb +57 -0
- data/lib/when_exe/region/indian.rb +41 -73
- data/lib/when_exe/region/international_fixed.rb +97 -0
- data/lib/when_exe/region/iranian.rb +203 -203
- data/lib/when_exe/region/japanese.rb +13 -13
- data/lib/when_exe/region/japanese/eclipses.rb +1194 -0
- data/lib/when_exe/region/japanese/notes.rb +1482 -1383
- data/lib/when_exe/region/japanese/residues.rb +726 -721
- data/lib/when_exe/region/japanese/twins.rb +37 -37
- data/lib/when_exe/region/jewish.rb +2 -2
- data/lib/when_exe/region/pax.rb +60 -0
- data/lib/when_exe/region/positivist.rb +100 -0
- data/lib/when_exe/region/roman.rb +333 -334
- data/lib/when_exe/region/shire.rb +3 -20
- data/lib/when_exe/region/thai.rb +2 -2
- data/lib/when_exe/region/tibetan.rb +3 -3
- data/lib/when_exe/region/tranquility.rb +208 -0
- data/lib/when_exe/region/vanishing_leprechaun.rb +53 -0
- data/lib/when_exe/region/vietnamese.rb +4 -4
- data/lib/when_exe/region/world.rb +9 -13
- data/lib/when_exe/region/world_season.rb +89 -0
- data/lib/when_exe/region/zoroastrian.rb +4 -2
- data/lib/when_exe/tmobjects.rb +14 -4
- data/lib/when_exe/tmposition.rb +239 -81
- data/lib/when_exe/tmreference.rb +57 -28
- data/lib/when_exe/version.rb +1 -1
- data/link_to_online_documents +6 -3
- data/test/examples/today.rb +1 -1
- data/test/scripts.rb +23 -0
- data/test/scripts/2.ext.rb +169 -0
- data/test/scripts/2.rb +169 -0
- data/test/scripts/3.ext.rb +133 -0
- data/test/scripts/3.rb +134 -0
- data/test/scripts/4.ext.rb +112 -0
- data/test/scripts/4.min.rb +65 -0
- data/test/scripts/4.rb +136 -0
- data/test/scripts/5.ext.rb +78 -0
- data/test/scripts/5.rb +81 -0
- data/test/scripts/6.gcal.rb +131 -0
- data/test/scripts/6.rb +205 -0
- data/test/scripts/6.tz.rb +105 -0
- data/test/scripts/7.phase.rb +109 -0
- data/test/scripts/7.rb +95 -0
- data/test/scripts/7.term.rb +128 -0
- data/test/scripts/7.week.rb +84 -0
- data/test/scripts/8.ext.rb +61 -0
- data/test/scripts/8.rb +62 -0
- data/test/scripts/9.ext.rb +131 -0
- data/test/scripts/9.rb +130 -0
- data/test/scripts/chinese-luni-solar.rb +52 -0
- data/test/{examples → scripts}/geometric_complex.rb +41 -41
- data/test/scripts/geometric_complex.txt +18 -0
- data/test/scripts/korea.rb +59 -0
- data/test/scripts/thai-reviewed.txt +211 -0
- data/test/scripts/thai.rb +36 -0
- data/test/scripts/thai.txt +210 -0
- data/test/test.rb +7 -0
- data/test/test/basictypes.rb +22 -0
- data/test/test/coordinates.rb +2 -1
- data/test/test/ephemeris.rb +34 -2
- data/test/test/icalendar.rb +12 -0
- data/test/test/inspect.rb +37 -1
- data/test/test/parts.rb +4 -3
- data/test/test/region/armenian.rb +20 -0
- data/test/test/region/bahai.rb +58 -0
- data/test/test/region/chinese.rb +14 -3
- data/test/test/region/christian.rb +16 -35
- data/test/test/region/discordian.rb +20 -0
- data/test/test/region/indian.rb +30 -2
- data/test/test/region/japanese.rb +24 -0
- data/test/test/region/jewish.rb +2 -0
- data/test/test/region/m17n.rb +9 -0
- data/test/test/region/reforms.rb +121 -0
- data/test/test/region/residue.rb +17 -11
- data/test/test/region/shire.rb +58 -0
- data/test/test/region/swedish.rb +45 -0
- data/test/test/region/zoroastrian.rb +58 -0
- data/test/test/tmobjects.rb +74 -0
- data/test/test/tmposition.rb +468 -397
- data/when_exe.gemspec +2 -2
- metadata +49 -6
|
@@ -13,63 +13,63 @@ module When
|
|
|
13
13
|
ChineseLuniSolar = [self, [
|
|
14
14
|
'locale:[=ja:, en=en:]',
|
|
15
15
|
'area:[中国の暦月=, *ChineseLuniSolar=]',
|
|
16
|
-
['[太初暦]1.01.01', '@CR', '1-01-01^ChineseTwin::太初暦'
|
|
17
|
-
['[四分暦]85.01.01', '@CR', '85-01-01^ChineseTwin::四分暦'
|
|
18
|
-
['[乾象暦]222.01.01', '@CR', '222-01-01^ChineseTwin::乾象暦'
|
|
19
|
-
['[景初暦]237.01.01', '@CR', '237-01-01^ChineseTwin::景初暦'
|
|
20
|
-
['[元嘉暦]445.01.01', '@CR', '445-01-01^ChineseTwin::元嘉暦'
|
|
21
|
-
['[大明暦]510.01.01', '@CR', '510-01-01^ChineseTwin::大明暦'
|
|
22
|
-
['[三紀暦=]384.01.01', '@CR', '384-01-01^ChineseTwin::三紀暦'
|
|
23
|
-
['[玄始暦=]412.01.01', '@CR', '412-01-01^ChineseTwin::玄始暦'
|
|
24
|
-
['[玄始暦=]452.01.01', '@CR', '452-01-01^ChineseTwin::玄始暦'
|
|
25
|
-
['[正光暦=]523.01.01', '@CR', '523-01-01^ChineseTwin::正光暦'
|
|
26
|
-
['[興和暦=]540.01.01', '@CR', '540-01-01^ChineseTwin::興和暦'
|
|
27
|
-
['[天保暦=]551.01.01', '@CR', '551-01-01^ChineseTwin::天保暦'
|
|
28
|
-
['[天和暦=]566.01.01', '@CR', '566-01-01^ChineseTwin::天和暦'
|
|
29
|
-
['[大象暦=]579.01.01', '@CR', '579-01-01^ChineseTwin::大象暦'
|
|
30
|
-
['[開皇暦=]584.01.01', '@CR', '584-01-01^ChineseTwin::開皇暦'
|
|
31
|
-
['[大業暦=]597.01.01', '@CR', '597-01-01^ChineseTwin::大業暦'
|
|
32
|
-
['[戊寅元暦]619.01.01', '@CR', '619-01-01^ChineseTwin::戊寅元暦'
|
|
33
|
-
['[平朔戊寅暦=]645.01.01','@CR','645-01-01^ChineseTwin::平朔戊寅暦'
|
|
34
|
-
['[麟徳暦]665.01.01', '@CR', '665-01-01^ChineseTwin::麟徳暦'
|
|
35
|
-
['[大衍暦]729.01.01', '@CR', '729-01-01^ChineseTwin::大衍暦'
|
|
36
|
-
['[五紀暦]762.01.01', '@CR', '762-01-01^ChineseTwin::五紀暦'
|
|
37
|
-
['[正元暦=]784.01.01', '@CR', '784-01-01^ChineseTwin::正元暦',
|
|
38
|
-
['[宣明暦]822.01.01', '@CR', '822-01-01^ChineseTwin::宣明暦'
|
|
39
|
-
['[崇玄暦=]893.01.01', '@CR', '893-01-01^ChineseTwin::崇玄暦',
|
|
40
|
-
['[授時暦]1281.01.01', '@CR','1281-01-01^ChineseTwin::授時暦'
|
|
41
|
-
['[大統暦]1368.01.01', '@CR','1368-01-01^ChineseTwin::大統暦',
|
|
16
|
+
['[太初暦]1.01.01', '@CR', '1-01-01^ChineseTwin::太初暦'], # 西暦が正になるところから開始(実際は-103.01.01)
|
|
17
|
+
['[四分暦]85.01.01', '@CR', '85-01-01^ChineseTwin::四分暦'],
|
|
18
|
+
['[乾象暦]222.01.01', '@CR', '222-01-01^ChineseTwin::乾象暦'],
|
|
19
|
+
['[景初暦]237.01.01', '@CR', '237-01-01^ChineseTwin::景初暦'],
|
|
20
|
+
['[元嘉暦]445.01.01', '@CR', '445-01-01^ChineseTwin::元嘉暦'],
|
|
21
|
+
['[大明暦]510.01.01', '@CR', '510-01-01^ChineseTwin::大明暦'],
|
|
22
|
+
['[三紀暦=]384.01.01', '@CR', '384-01-01^ChineseTwin::三紀暦'],
|
|
23
|
+
['[玄始暦=]412.01.01', '@CR', '412-01-01^ChineseTwin::玄始暦'],
|
|
24
|
+
['[玄始暦=]452.01.01', '@CR', '452-01-01^ChineseTwin::玄始暦'],
|
|
25
|
+
['[正光暦=]523.01.01', '@CR', '523-01-01^ChineseTwin::正光暦'],
|
|
26
|
+
['[興和暦=]540.01.01', '@CR', '540-01-01^ChineseTwin::興和暦'],
|
|
27
|
+
['[天保暦=]551.01.01', '@CR', '551-01-01^ChineseTwin::天保暦'],
|
|
28
|
+
['[天和暦=]566.01.01', '@CR', '566-01-01^ChineseTwin::天和暦'],
|
|
29
|
+
['[大象暦=]579.01.01', '@CR', '579-01-01^ChineseTwin::大象暦'],
|
|
30
|
+
['[開皇暦=]584.01.01', '@CR', '584-01-01^ChineseTwin::開皇暦'],
|
|
31
|
+
['[大業暦=]597.01.01', '@CR', '597-01-01^ChineseTwin::大業暦'],
|
|
32
|
+
['[戊寅元暦]619.01.01', '@CR', '619-01-01^ChineseTwin::戊寅元暦'],
|
|
33
|
+
['[平朔戊寅暦=]645.01.01','@CR','645-01-01^ChineseTwin::平朔戊寅暦'],
|
|
34
|
+
['[麟徳暦]665.01.01', '@CR', '665-01-01^ChineseTwin::麟徳暦'],
|
|
35
|
+
['[大衍暦]729.01.01', '@CR', '729-01-01^ChineseTwin::大衍暦'],
|
|
36
|
+
['[五紀暦]762.01.01', '@CR', '762-01-01^ChineseTwin::五紀暦'],
|
|
37
|
+
['[正元暦=]784.01.01', '@CR', '784-01-01^ChineseTwin::正元暦', '807-01-01'],
|
|
38
|
+
['[宣明暦]822.01.01', '@CR', '822-01-01^ChineseTwin::宣明暦'],
|
|
39
|
+
['[崇玄暦=]893.01.01', '@CR', '893-01-01^ChineseTwin::崇玄暦', '956-01-01'],
|
|
40
|
+
['[授時暦]1281.01.01', '@CR','1281-01-01^ChineseTwin::授時暦'],
|
|
41
|
+
['[大統暦]1368.01.01', '@CR','1368-01-01^ChineseTwin::大統暦', '1645-01-01']
|
|
42
42
|
]]
|
|
43
43
|
|
|
44
44
|
# Chinese Solar Calendar Series for Chinese Note
|
|
45
45
|
ChineseSolar = [self, [
|
|
46
46
|
'locale:[=ja:, en=en:]',
|
|
47
47
|
'area:[中国の節月=, *ChineseSolar=]',
|
|
48
|
-
['[太初暦]1.01.01', '@CR', '1-01-01^ChineseTwin::太初暦(節月)'
|
|
49
|
-
['[四分暦]85.01.07', '@CR', '85-01-07^ChineseTwin::四分暦(節月)'
|
|
50
|
-
['[乾象暦]221.12.23', '@CR', '221-12-23^ChineseTwin::乾象暦(節月)'
|
|
51
|
-
['[景初暦]237.01.07', '@CR', '237-01-07^ChineseTwin::景初暦(節月)'
|
|
52
|
-
['[元嘉暦]444.12.22', '@CR', '444-12-22^ChineseTwin::元嘉暦(節月)'
|
|
53
|
-
['[大明暦]509.12.23', '@CR', '509-12-23^ChineseTwin::大明暦(節月)'
|
|
54
|
-
['[三紀暦=]384.01.02', '@CR', '384-01-02^ChineseTwin::三紀暦(節月)'
|
|
55
|
-
['[玄始暦=]411.12.26', '@CR', '411-12-26^ChineseTwin::玄始暦(節月)'
|
|
56
|
-
['[玄始暦=]452.01.02', '@CR', '452-01-02^ChineseTwin::玄始暦(節月)'
|
|
57
|
-
['[正光暦=]522.12.29', '@CR', '522-12-29^ChineseTwin::正光暦(節月)'
|
|
58
|
-
['[興和暦=]539.12.22', '@CR', '539-12-22^ChineseTwin::興和暦(節月)'
|
|
59
|
-
['[天保暦=]550.12.19', '@CR', '550-12-19^ChineseTwin::天保暦(節月)'
|
|
60
|
-
['[天和暦=]566.01.05', '@CR', '566-01-05^ChineseTwin::天和暦(節月)'
|
|
61
|
-
['[大象暦=]579.01.11', '@CR', '579-01-11^ChineseTwin::大象暦(節月)'
|
|
62
|
-
['[開皇暦=]584.01.16', '@CR', '584-01-16^ChineseTwin::開皇暦(節月)'
|
|
63
|
-
['[大業暦=]596.12.22', '@CR', '596-12-22^ChineseTwin::大業暦(節月)'
|
|
64
|
-
['[戊寅元暦]618.12.19', '@CR', '618-12-19^ChineseTwin::戊寅元暦(節月)'
|
|
65
|
-
['[麟徳暦]664.12.21', '@CR', '664-12-21^ChineseTwin::麟徳暦(節月)'
|
|
66
|
-
['[大衍暦]729.01.03', '@CR', '729-01-03^ChineseTwin::大衍暦(節月)'
|
|
67
|
-
['[五紀暦]761.12.29', '@CR', '761-12-29^ChineseTwin::五紀暦(節月)'
|
|
68
|
-
['[正元暦=]783.12.26', '@CR', '783-12-26^ChineseTwin::正元暦(節月)',
|
|
69
|
-
['[宣明暦]821.01.01', '@CR', '821-01-01^ChineseTwin::宣明暦(節月)'
|
|
70
|
-
['[崇玄暦=]892.12.22', '@CR', '892-12-22^ChineseTwin::崇玄暦(節月)',
|
|
71
|
-
['[授時暦]1280.01.01', '@CR', '1280-01-01^ChineseTwin::授時暦(節月)'
|
|
72
|
-
['[大統暦]1367.12.24', '@CR', '1367-12-24^ChineseTwin::大統暦(節月)',
|
|
48
|
+
['[太初暦]1.01.01', '@CR', '1-01-01^ChineseTwin::太初暦(節月)'], # 西暦が正になるところから開始(実際は-103.01.15)
|
|
49
|
+
['[四分暦]85.01.07', '@CR', '85-01-07^ChineseTwin::四分暦(節月)'],
|
|
50
|
+
['[乾象暦]221.12.23', '@CR', '221-12-23^ChineseTwin::乾象暦(節月)'],
|
|
51
|
+
['[景初暦]237.01.07', '@CR', '237-01-07^ChineseTwin::景初暦(節月)'],
|
|
52
|
+
['[元嘉暦]444.12.22', '@CR', '444-12-22^ChineseTwin::元嘉暦(節月)'],
|
|
53
|
+
['[大明暦]509.12.23', '@CR', '509-12-23^ChineseTwin::大明暦(節月)'],
|
|
54
|
+
['[三紀暦=]384.01.02', '@CR', '384-01-02^ChineseTwin::三紀暦(節月)'],
|
|
55
|
+
['[玄始暦=]411.12.26', '@CR', '411-12-26^ChineseTwin::玄始暦(節月)'],
|
|
56
|
+
['[玄始暦=]452.01.02', '@CR', '452-01-02^ChineseTwin::玄始暦(節月)'],
|
|
57
|
+
['[正光暦=]522.12.29', '@CR', '522-12-29^ChineseTwin::正光暦(節月)'],
|
|
58
|
+
['[興和暦=]539.12.22', '@CR', '539-12-22^ChineseTwin::興和暦(節月)'],
|
|
59
|
+
['[天保暦=]550.12.19', '@CR', '550-12-19^ChineseTwin::天保暦(節月)'],
|
|
60
|
+
['[天和暦=]566.01.05', '@CR', '566-01-05^ChineseTwin::天和暦(節月)'],
|
|
61
|
+
['[大象暦=]579.01.11', '@CR', '579-01-11^ChineseTwin::大象暦(節月)'],
|
|
62
|
+
['[開皇暦=]584.01.16', '@CR', '584-01-16^ChineseTwin::開皇暦(節月)'],
|
|
63
|
+
['[大業暦=]596.12.22', '@CR', '596-12-22^ChineseTwin::大業暦(節月)'],
|
|
64
|
+
['[戊寅元暦]618.12.19', '@CR', '618-12-19^ChineseTwin::戊寅元暦(節月)'],
|
|
65
|
+
['[麟徳暦]664.12.21', '@CR', '664-12-21^ChineseTwin::麟徳暦(節月)'],
|
|
66
|
+
['[大衍暦]729.01.03', '@CR', '729-01-03^ChineseTwin::大衍暦(節月)'],
|
|
67
|
+
['[五紀暦]761.12.29', '@CR', '761-12-29^ChineseTwin::五紀暦(節月)'],
|
|
68
|
+
['[正元暦=]783.12.26', '@CR', '783-12-26^ChineseTwin::正元暦(節月)', '807-01-11'],
|
|
69
|
+
['[宣明暦]821.01.01', '@CR', '821-01-01^ChineseTwin::宣明暦(節月)'], # 年の始めに遡って開始(実際は12.27)
|
|
70
|
+
['[崇玄暦=]892.12.22', '@CR', '892-12-22^ChineseTwin::崇玄暦(節月)', '956-01-15'],
|
|
71
|
+
['[授時暦]1280.01.01', '@CR', '1280-01-01^ChineseTwin::授時暦(節月)'],
|
|
72
|
+
['[大統暦]1367.12.24', '@CR', '1367-12-24^ChineseTwin::大統暦(節月)', '1644-12-24']
|
|
73
73
|
]]
|
|
74
74
|
end
|
|
75
75
|
|
|
@@ -105,6 +105,7 @@ module When
|
|
|
105
105
|
def _normalize(args=[], options={})
|
|
106
106
|
raise TypeError, "#{self.class} is abstract class" unless @label
|
|
107
107
|
@note = When.CalendarNote(@note || 'Christian')
|
|
108
|
+
@diff_to_CE ||= 0
|
|
108
109
|
super
|
|
109
110
|
end
|
|
110
111
|
end
|
|
@@ -364,7 +365,7 @@ module When
|
|
|
364
365
|
# @return nil
|
|
365
366
|
#
|
|
366
367
|
def first_year_of_border
|
|
367
|
-
return nil unless @border.kind_of?(When::
|
|
368
|
+
return nil unless @border.kind_of?(When::Coordinates::MultiBorder)
|
|
368
369
|
year = @border.borders[-1][:key]
|
|
369
370
|
year.kind_of?(Integer) ? year : nil
|
|
370
371
|
end
|
|
@@ -503,6 +504,9 @@ module When
|
|
|
503
504
|
(skip && digit >= limit ? digit+skip : digit)+@base[date.length-1]
|
|
504
505
|
end
|
|
505
506
|
end
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
module Coordinates
|
|
506
510
|
|
|
507
511
|
#
|
|
508
512
|
# 日時要素の境界 - 復活祭
|
|
@@ -783,7 +787,8 @@ module When
|
|
|
783
787
|
# 任意の暦をグレゴリオorユリウス暦日に変換
|
|
784
788
|
#
|
|
785
789
|
def _to_date_for_note(date)
|
|
786
|
-
return When.Calendar(When::CalendarTypes::Christian._default_start(date)) ^ date if ::Object.const_defined?(:Date) &&
|
|
790
|
+
return When.Calendar(When::CalendarTypes::Christian._default_start(date)) ^ date if ::Object.const_defined?(:Date) &&
|
|
791
|
+
::Date.method_defined?(:+) && date.kind_of?(::Date)
|
|
787
792
|
return When::Gregorian ^ date if date.kind_of?(::Time)
|
|
788
793
|
return date if date.frame.kind_of?(When::CalendarTypes::Christian)
|
|
789
794
|
When.Calendar(date.frame.iri =~ /Coptic/ || date.to_i < 2299161 ? 'Julian' : 'Gregorian') ^ date
|
|
@@ -173,7 +173,7 @@ module When
|
|
|
173
173
|
#
|
|
174
174
|
# Discordian Calendar
|
|
175
175
|
#
|
|
176
|
-
class Discordian <
|
|
176
|
+
class Discordian < YearLengthTableBased
|
|
177
177
|
|
|
178
178
|
# @private
|
|
179
179
|
Normal_IDS = (1..73).to_a
|
|
@@ -188,14 +188,13 @@ module When
|
|
|
188
188
|
#
|
|
189
189
|
def _normalize(args=[], options={})
|
|
190
190
|
@label ||= 'Discordian'
|
|
191
|
-
@epoch_in_CE ||= -1166
|
|
192
|
-
@note ||= 'DiscordianWeek'
|
|
193
|
-
@engine ||= 'Gregorian'
|
|
194
|
-
@engine = When.Calendar(@engine)
|
|
195
191
|
@indices ||= [
|
|
196
192
|
When.Index('DiscordianWeekNotes::month::Month', {:unit =>5}),
|
|
197
193
|
When.Index({:branch=>{1=>When.M17n('Discordian::IntercalaryDay')[0]}})
|
|
198
194
|
]
|
|
195
|
+
@origin_of_MSC ||= +1166
|
|
196
|
+
@diff_to_CE ||= 0
|
|
197
|
+
@note ||= 'DiscordianWeek'
|
|
199
198
|
@rule_table ||= {
|
|
200
199
|
365 => {'Length'=> [73]*5},
|
|
201
200
|
366 => {'Length'=> [74] + [73]*4}
|
|
@@ -203,22 +202,16 @@ module When
|
|
|
203
202
|
super
|
|
204
203
|
end
|
|
205
204
|
|
|
206
|
-
# first day of year
|
|
207
|
-
#
|
|
208
|
-
def _sdn_(date)
|
|
209
|
-
year = +date[0] + @epoch_in_CE
|
|
210
|
-
@engine._coordinates_to_number(year, 0, 0)
|
|
211
|
-
end
|
|
212
|
-
|
|
213
205
|
#
|
|
214
206
|
# day arrangement pattern
|
|
215
207
|
#
|
|
216
208
|
def _ids_(date)
|
|
217
209
|
y, m = date
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
210
|
+
case m
|
|
211
|
+
when nil ; super
|
|
212
|
+
when 0 ; @engine._length([+y, 1]) == 28 ? Normal_IDS : Long_IDS
|
|
213
|
+
else ; Normal_IDS
|
|
214
|
+
end
|
|
222
215
|
end
|
|
223
216
|
end
|
|
224
217
|
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
=begin
|
|
3
|
+
Copyright (C) 2014 Takashi SUGA
|
|
4
|
+
|
|
5
|
+
You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
|
|
6
|
+
=end
|
|
7
|
+
|
|
8
|
+
module When
|
|
9
|
+
|
|
10
|
+
class BasicTypes::M17n
|
|
11
|
+
|
|
12
|
+
HankeHenry = [self, [
|
|
13
|
+
"locale:[=en:, ja]",
|
|
14
|
+
"names:[HankeHenry=]",
|
|
15
|
+
"[HankeHenry=en:Hanke-Henry_Permanent_Calendar, ハンキ=ヘンリー暦=ja:%%<ハンキ=ヘンリー・パーマネント・カレンダー>]",
|
|
16
|
+
|
|
17
|
+
[self,
|
|
18
|
+
"names:[Month, 月=ja:%%<月_(暦)>]",
|
|
19
|
+
"[January, 1月, /date/month_names/1] ",
|
|
20
|
+
"[February, 2月, /date/month_names/2] ",
|
|
21
|
+
"[March, 3月, /date/month_names/3] ",
|
|
22
|
+
"[April, 4月, /date/month_names/4] ",
|
|
23
|
+
"[May, 5月, /date/month_names/5] ",
|
|
24
|
+
"[June, 6月, /date/month_names/6] ",
|
|
25
|
+
"[July, 7月, /date/month_names/7] ",
|
|
26
|
+
"[August, 8月, /date/month_names/8] ",
|
|
27
|
+
"[September, 9月, /date/month_names/9] ",
|
|
28
|
+
"[October, 10月, /date/month_names/10]",
|
|
29
|
+
"[November, 11月, /date/month_names/11]",
|
|
30
|
+
"[December, 12月, /date/month_names/12]",
|
|
31
|
+
"[Xtra=en:Hanke-Henry_Permanent_Calendar, 追加週=ja:%%<ハンキ=ヘンリー・パーマネント・カレンダー>]" # Leap week
|
|
32
|
+
]
|
|
33
|
+
]]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
module CalendarTypes
|
|
37
|
+
|
|
38
|
+
#
|
|
39
|
+
# Hanke-Henry Calendar
|
|
40
|
+
#
|
|
41
|
+
HankeHenry = [CyclicTableBased, {
|
|
42
|
+
'label' => 'HankeHenry::HankeHenry',
|
|
43
|
+
'origin_of_LSC' => 1721061,
|
|
44
|
+
'indices' => [
|
|
45
|
+
When.Index('HankeHenry::Month'),
|
|
46
|
+
When::Coordinates::DefaultDayIndex
|
|
47
|
+
],
|
|
48
|
+
'rule_table' => {
|
|
49
|
+
'T' => {'Rule' =>(2000...2400).to_a.map {|year|
|
|
50
|
+
[When.tm_pos(year,1,1), When.tm_pos(year,12,31)].map {|date| date.to_i % 7}.include?(3) ? 371 : 364
|
|
51
|
+
}},
|
|
52
|
+
364 => {'Length'=>[30,30,31]*4},
|
|
53
|
+
371 => {'Length'=>[30,30,31]*4 +[7]}
|
|
54
|
+
}
|
|
55
|
+
}]
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -562,91 +562,59 @@ module When
|
|
|
562
562
|
#
|
|
563
563
|
# Indian national solar calendar
|
|
564
564
|
#
|
|
565
|
-
IndianNationalSolar = [
|
|
565
|
+
IndianNationalSolar = [TableBasedWithSunrise, {
|
|
566
566
|
'label' => 'Indian::IndianNationalSolar',
|
|
567
|
-
'origin_of_LSC' => 1721140,
|
|
568
567
|
'origin_of_MSC' => -78,
|
|
569
|
-
'
|
|
568
|
+
'diff_to_CE' => 0,
|
|
569
|
+
'engine_month' => 2, # February
|
|
570
|
+
'engine_day' => 28+22, # 22nd of next month
|
|
570
571
|
'indices' => [
|
|
571
572
|
When.Index('Indian::LunarMonth', {:unit =>12, :shift=>4}),
|
|
572
573
|
When::Coordinates::DefaultDayIndex
|
|
573
574
|
],
|
|
574
|
-
'rule_table'
|
|
575
|
-
'T' => {'Rule' =>['LC', 'SC', 'SC', 'SC']},
|
|
576
|
-
'SC' => {'Rule' =>[365]*4 + [366, 365, 365, 365]*24},
|
|
577
|
-
'LC' => {'Rule' =>[366, 365, 365, 365]*25},
|
|
575
|
+
'rule_table' => {
|
|
578
576
|
365 => {'Length'=>[30] + [31]*5 + [30]*6},
|
|
579
577
|
366 => {'Length'=> [31]*6 + [30]*6}
|
|
580
|
-
}
|
|
578
|
+
}
|
|
581
579
|
}]
|
|
582
580
|
|
|
583
581
|
#
|
|
584
582
|
# Nanakshahi Calendar
|
|
585
583
|
#
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
]
|
|
602
|
-
@rule_table ||= {
|
|
603
|
-
365 => {'Length'=> [31]*5 + [30]*7},
|
|
604
|
-
366 => {'Length'=> [31]*5 + [30]*6 + [31]}
|
|
605
|
-
}
|
|
606
|
-
super
|
|
607
|
-
end
|
|
608
|
-
|
|
609
|
-
# first day of year
|
|
610
|
-
#
|
|
611
|
-
def _sdn_(date)
|
|
612
|
-
year = +date[0] + @epoch_in_CE
|
|
613
|
-
@engine._coordinates_to_number(year, 2, 13)
|
|
614
|
-
end
|
|
615
|
-
end
|
|
584
|
+
Nanakshahi = [YearLengthTableBased, {
|
|
585
|
+
'label' => 'Indian::Nanakshahi',
|
|
586
|
+
'origin_of_MSC' => -1468,
|
|
587
|
+
'diff_to_CE' => 0,
|
|
588
|
+
'engine_month' => 3,
|
|
589
|
+
'engine_day' => 14,
|
|
590
|
+
'indices' => [
|
|
591
|
+
When.Index('Indian::NanakshahiMonth', {:unit=>12, :shift=>4}),
|
|
592
|
+
When::Coordinates::DefaultDayIndex
|
|
593
|
+
],
|
|
594
|
+
'rule_table' => {
|
|
595
|
+
365 => {'Length'=> [31]*5 + [30]*7},
|
|
596
|
+
366 => {'Length'=> [31]*5 + [30]*6 + [31]}
|
|
597
|
+
}
|
|
598
|
+
}]
|
|
616
599
|
|
|
617
600
|
#
|
|
618
601
|
# Revised Bengali Calendar
|
|
619
602
|
#
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
]
|
|
636
|
-
@rule_table ||= {
|
|
637
|
-
365 => {'Length'=> [31]*5 + [30]*7},
|
|
638
|
-
366 => {'Length'=> [31]*5 + [30]*5 + [31, 30]}
|
|
639
|
-
}
|
|
640
|
-
super
|
|
641
|
-
end
|
|
642
|
-
|
|
643
|
-
# first day of year
|
|
644
|
-
#
|
|
645
|
-
def _sdn_(date)
|
|
646
|
-
year = +date[0] + @epoch_in_CE
|
|
647
|
-
@engine._coordinates_to_number(year, 3, 13)
|
|
648
|
-
end
|
|
649
|
-
end
|
|
603
|
+
RevisedBengali = [YearLengthTableBased, {
|
|
604
|
+
'label' => 'Indian::RevisedBengali',
|
|
605
|
+
'origin_of_MSC' => -593,
|
|
606
|
+
'diff_to_CE' => 0,
|
|
607
|
+
'engine_month' => 4,
|
|
608
|
+
'engine_day' => 14,
|
|
609
|
+
'indices' => [
|
|
610
|
+
When.Index('Indian::BengaliMonth', {:unit=>12, :shift=>5}),
|
|
611
|
+
When::Coordinates::DefaultDayIndex
|
|
612
|
+
],
|
|
613
|
+
'rule_table' => {
|
|
614
|
+
365 => {'Length'=> [31]*5 + [30]*7},
|
|
615
|
+
366 => {'Length'=> [31]*5 + [30]*5 + [31, 30]}
|
|
616
|
+
}
|
|
617
|
+
}]
|
|
650
618
|
|
|
651
619
|
#
|
|
652
620
|
# Hindu Solar Calendar
|
|
@@ -679,12 +647,12 @@ module When
|
|
|
679
647
|
def _normalize(args=[], options={})
|
|
680
648
|
@label ||= 'Indian::HinduSolar'
|
|
681
649
|
@type ||= 'SBS'
|
|
682
|
-
raise ArgumentError, "Irregal formula: #{@formula}" unless @type.upcase =~ /\A(M|SS|SB)(V|S
|
|
650
|
+
raise ArgumentError, "Irregal formula: #{@formula}" unless @type.upcase =~ /\A(M|SS|SB)(V|S|B|H|VZ|SZ|BZ|HZ)\z/
|
|
683
651
|
|
|
684
652
|
@location ||= HinduLuniSolar::Location_E[$2] || HinduLuniSolar::Location_F[$1]
|
|
685
653
|
@cycle_offset ||= HinduLuniSolar::CycleOffset[$1]
|
|
686
654
|
@origin_of_MSC ||= -HinduLuniSolar::YearEpoch[$2]
|
|
687
|
-
@
|
|
655
|
+
@diff_to_CE ||= 0
|
|
688
656
|
@start_month ||= 1 # Maysha
|
|
689
657
|
@start_month = @start_month.to_i
|
|
690
658
|
@cycle_offset = @cycle_offset.to_f + (@start_month - 1)
|
|
@@ -822,13 +790,13 @@ module When
|
|
|
822
790
|
def _normalize(args=[], options={})
|
|
823
791
|
@label ||= 'Indian::HinduLuniSolar'
|
|
824
792
|
@type ||= 'SBSA'
|
|
825
|
-
raise ArgumentError, "Irregal formula: #{@formula}" unless @type.upcase =~ /\A(M|SS|SB)(V|S
|
|
793
|
+
raise ArgumentError, "Irregal formula: #{@formula}" unless @type.upcase =~ /\A(M|SS|SB)(V|S|B|H|VZ|SZ|BZ|HZ)(A|P|PX)\z/
|
|
826
794
|
|
|
827
795
|
@location ||= Location_E[$2] || Location_F[$1]
|
|
828
796
|
@cycle_offset ||= CycleOffset[$1]
|
|
829
797
|
@origin_of_MSC ||= -YearEpoch[$2]
|
|
830
798
|
@hindu_style ||= HinduStyle[$3]
|
|
831
|
-
@
|
|
799
|
+
@diff_to_CE ||= 0
|
|
832
800
|
@start_month ||= 5 # Chaitra
|
|
833
801
|
@start_month = @start_month.to_i
|
|
834
802
|
@cycle_offset = @cycle_offset.to_f + (@start_month - 5)
|
|
@@ -1133,7 +1101,7 @@ module When
|
|
|
1133
1101
|
# see {http://en.wikipedia.org/wiki/Samvatsara Samvatsara}
|
|
1134
1102
|
#
|
|
1135
1103
|
def samvatsara(dates)
|
|
1136
|
-
year_kali = dates.l_date.most_significant_coordinate + dates.l_date.frame.
|
|
1104
|
+
year_kali = dates.l_date.most_significant_coordinate + dates.l_date.frame.epoch_in_CE + 3101
|
|
1137
1105
|
year_mod = year_kali >= jovian ? (year_kali + 12) % 60 :
|
|
1138
1106
|
((year_kali * 211 - 108).div(18000) + year_kali + 26) % 60
|
|
1139
1107
|
When.CalendarNote('HinduNote/Notes')['year']['samvatsara'][year_mod]
|