@unicom-cloud/utils 0.1.10 → 0.1.12
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.
- package/caseName.js +11 -0
- package/className.js +5 -0
- package/clipboardCopy.js +6 -0
- package/constant.js +4 -0
- package/contentDisposition.js +7 -0
- package/cookie.js +7 -0
- package/date/convertTime.js +61 -0
- package/date/index.js +22 -0
- package/date.js +9 -0
- package/decimal.js +5 -0
- package/eventEmitter.js +4 -0
- package/file.js +6 -0
- package/filesize.js +8 -0
- package/index.js +56 -46
- package/invariant.js +4 -0
- package/is.js +92 -0
- package/lunar/index.js +36 -0
- package/lunar/lib/Holiday.js +42 -0
- package/lunar/lib/HolidayUtil.js +128 -0
- package/lunar/lib/I18n.js +1005 -0
- package/lunar/lib/JieQi.js +40 -0
- package/lunar/lib/Lunar.js +1035 -0
- package/lunar/lib/LunarMonth.js +150 -0
- package/lunar/lib/LunarTime.js +138 -0
- package/lunar/lib/LunarUtil.js +1752 -0
- package/lunar/lib/LunarYear.js +616 -0
- package/lunar/lib/ShouXingUtil.js +6915 -0
- package/lunar/lib/Solar.js +311 -0
- package/lunar/lib/SolarHalfYear.js +45 -0
- package/lunar/lib/SolarMonth.js +55 -0
- package/lunar/lib/SolarSeason.js +42 -0
- package/lunar/lib/SolarUtil.js +256 -0
- package/lunar/lib/SolarWeek.js +153 -0
- package/lunar/lib/SolarYear.js +35 -0
- package/lunar/lib/index.js +35 -0
- package/lunar.js +36 -0
- package/math.js +9 -0
- package/md5.js +4 -0
- package/mock.js +8 -0
- package/normalizeWheel.js +6 -0
- package/number-to-chinese/index.js +72 -0
- package/numberToChinese.js +4 -0
- package/nzh.js +4 -0
- package/object-keys-sort/index.js +7 -0
- package/objectKeysSort.js +2 -5
- package/package.json +1 -1
- package/random.js +15 -0
- package/screenfull.js +4 -0
- package/snapdom/src/api/preCache.js +26 -36
- package/snapdom/src/api/snapdom.js +78 -61
- package/snapdom/src/core/capture.js +54 -54
- package/snapdom/src/core/prepare.js +46 -37
- package/snapdom/src/modules/fonts.js +90 -92
- package/snapdom/src/modules/iconFonts.js +28 -0
- package/snapdom/src/modules/images.js +6 -6
- package/snapdom/src/modules/pseudo.js +51 -49
- package/snapdom/src/modules/styles.js +27 -7
- package/snapdom/src/modules/svgDefs.js +26 -0
- package/snapdom/src/utils/helpers.js +150 -103
- package/snapdom.js +6 -0
- package/tinycolor/index.js +46 -0
- package/tinycolor/src/conversion.js +143 -0
- package/tinycolor/src/css-color-names.js +153 -0
- package/tinycolor/src/format-input.js +77 -0
- package/tinycolor/src/from-ratio.js +21 -0
- package/tinycolor/src/index.js +404 -0
- package/tinycolor/src/random.js +221 -0
- package/tinycolor/src/readability.js +37 -0
- package/tinycolor/src/to-ms-filter.js +15 -0
- package/tinycolor/src/util.js +32 -0
- package/tinycolor.js +46 -0
- package/tree/index.js +10 -8
- package/tree/searchTree.js +54 -0
- package/tree.js +13 -0
- package/turboStream.js +6 -0
- package/types/case-name/index.d.ts +11 -0
- package/types/class-name/index.d.ts +2 -0
- package/types/clipboard-copy/index.d.ts +2 -0
- package/types/constant/address.d.ts +14 -0
- package/types/constant/chineseCharacters.d.ts +2 -0
- package/types/constant/constellations.d.ts +2 -0
- package/types/constant/domain.d.ts +2 -0
- package/types/constant/identity.d.ts +2 -0
- package/types/constant/index.d.ts +1 -0
- package/types/constant/keyboardCode.d.ts +158 -0
- package/types/constant/licensePlate.d.ts +2 -0
- package/types/constant/name.d.ts +4 -0
- package/types/constant/platform.d.ts +11 -0
- package/types/constant/protocol.d.ts +2 -0
- package/types/constant/ui.d.ts +14 -0
- package/types/content-disposition/index.d.ts +10 -0
- package/types/cookie/index.d.ts +4 -0
- package/types/cookie/src/index.d.ts +114 -0
- package/types/date/convertTime.d.ts +32 -0
- package/types/date/index.d.ts +4 -0
- package/types/decimal/decimal.d.ts +4 -0
- package/types/decimal/index.d.ts +1 -0
- package/types/event-emitter/index.d.ts +17 -0
- package/types/file/fileToURL.d.ts +2 -0
- package/types/file/index.d.ts +3 -0
- package/types/file/saveAs.d.ts +2 -0
- package/types/filesize/index.d.ts +2 -0
- package/types/filesize/src/constants.d.ts +42 -0
- package/types/filesize/src/filesize.d.ts +47 -0
- package/types/index.d.ts +25 -0
- package/types/invariant/index.d.ts +2 -0
- package/types/is/index.d.ts +53 -0
- package/types/lunar/index.d.ts +3 -0
- package/types/lunar/lib/Holiday.d.ts +17 -0
- package/types/lunar/lib/HolidayUtil.d.ts +23 -0
- package/types/lunar/lib/I18n.d.ts +23 -0
- package/types/lunar/lib/JieQi.d.ts +15 -0
- package/types/lunar/lib/Lunar.d.ts +245 -0
- package/types/lunar/lib/LunarMonth.d.ts +35 -0
- package/types/lunar/lib/LunarTime.d.ts +40 -0
- package/types/lunar/lib/LunarUtil.d.ts +128 -0
- package/types/lunar/lib/LunarYear.d.ts +61 -0
- package/types/lunar/lib/ShouXingUtil.d.ts +38 -0
- package/types/lunar/lib/Solar.d.ts +51 -0
- package/types/lunar/lib/SolarHalfYear.d.ts +15 -0
- package/types/lunar/lib/SolarMonth.d.ts +16 -0
- package/types/lunar/lib/SolarSeason.d.ts +15 -0
- package/types/lunar/lib/SolarUtil.d.ts +20 -0
- package/types/lunar/lib/SolarWeek.d.ts +23 -0
- package/types/lunar/lib/SolarYear.d.ts +12 -0
- package/types/lunar/lib/index.d.ts +17 -0
- package/types/math/index.d.ts +11 -0
- package/types/md5/index.d.ts +2 -0
- package/types/mock/MockWebSocket.d.ts +17 -0
- package/types/mock/MockXMLHttpRequest.d.ts +17 -0
- package/types/mock/index.d.ts +2 -0
- package/types/normalize-wheel/ExecutionEnvironment.d.ts +9 -0
- package/types/normalize-wheel/UserAgent_DEPRECATED.d.ts +86 -0
- package/types/normalize-wheel/index.d.ts +115 -0
- package/types/normalize-wheel/isEventSupported.d.ts +16 -0
- package/types/number-to-chinese/index.d.ts +11 -0
- package/types/nzh/cn.d.ts +8 -0
- package/types/nzh/hk.d.ts +8 -0
- package/types/nzh/index.d.ts +1 -0
- package/types/nzh/nzh.d.ts +36 -0
- package/types/nzh/src/autoGet.d.ts +8 -0
- package/types/nzh/src/index.d.ts +34 -0
- package/types/nzh/src/langs/cn_b.d.ts +10 -0
- package/types/nzh/src/langs/cn_s.d.ts +7 -0
- package/types/nzh/src/langs/hk_b.d.ts +10 -0
- package/types/nzh/src/langs/hk_s.d.ts +7 -0
- package/types/nzh/src/utils.d.ts +65 -0
- package/types/object-keys-sort/index.d.ts +4 -0
- package/types/random/address.d.ts +8 -0
- package/types/random/constellation.d.ts +2 -0
- package/types/random/image.d.ts +5 -0
- package/types/random/index.d.ts +40 -0
- package/types/random/licensePlate.d.ts +2 -0
- package/types/random/name.d.ts +9 -0
- package/types/random/number.d.ts +6 -0
- package/types/random/text.d.ts +13 -0
- package/types/random/time.d.ts +2 -0
- package/types/random/web.d.ts +11 -0
- package/types/screenfull/index.d.ts +10 -0
- package/types/snapdom/index.d.ts +1 -0
- package/types/snapdom/src/api/preCache.d.ts +8 -0
- package/types/snapdom/src/api/snapdom.d.ts +26 -0
- package/types/snapdom/src/core/cache.d.ts +11 -0
- package/types/snapdom/src/core/capture.d.ts +17 -0
- package/types/snapdom/src/core/clone.d.ts +11 -0
- package/types/snapdom/src/core/prepare.d.ts +8 -0
- package/types/snapdom/src/index.browser.d.ts +1 -0
- package/types/snapdom/src/index.d.ts +2 -0
- package/types/snapdom/src/modules/background.d.ts +10 -0
- package/types/snapdom/src/modules/fonts.d.ts +23 -0
- package/types/snapdom/src/modules/iconFonts.d.ts +2 -0
- package/types/snapdom/src/modules/images.d.ts +8 -0
- package/types/snapdom/src/modules/pseudo.d.ts +12 -0
- package/types/snapdom/src/modules/styles.d.ts +1 -0
- package/types/snapdom/src/modules/svgDefs.d.ts +19 -0
- package/types/snapdom/src/utils/cssTools.d.ts +38 -0
- package/types/snapdom/src/utils/helpers.d.ts +71 -0
- package/types/tinycolor/index.d.ts +2 -0
- package/types/tinycolor/src/conversion.d.ts +79 -0
- package/types/tinycolor/src/css-color-names.d.ts +4 -0
- package/types/tinycolor/src/format-input.d.ts +38 -0
- package/types/tinycolor/src/from-ratio.d.ts +14 -0
- package/types/tinycolor/src/index.d.ts +214 -0
- package/types/tinycolor/src/interfaces.d.ts +57 -0
- package/types/tinycolor/src/public_api.d.ts +10 -0
- package/types/tinycolor/src/random.d.ts +24 -0
- package/types/tinycolor/src/readability.d.ts +46 -0
- package/types/tinycolor/src/to-ms-filter.d.ts +5 -0
- package/types/tinycolor/src/umd_api.d.ts +22 -0
- package/types/tinycolor/src/util.d.ts +36 -0
- package/types/tree/index.d.ts +9 -0
- package/types/tree/searchTree.d.ts +20 -0
- package/types/turbo-stream/index.d.ts +1 -0
- package/types/turbo-stream/src/decode.d.ts +7 -0
- package/types/turbo-stream/src/encode.d.ts +27 -0
- package/types/turbo-stream/src/shared.d.ts +107 -0
- package/types/turbo-stream/src/turbo-stream.d.ts +4 -0
- package/types/ui-color/compareColorByRange.d.ts +2 -0
- package/types/ui-color/index.d.ts +183 -0
- package/types/url-toolkit/index.d.ts +2 -0
- package/types/url-toolkit/src/url-toolkit.d.ts +18 -0
- package/ui-color/compareColorByRange.js +9 -0
- package/ui-color/index.js +155 -0
- package/uiColor.js +28 -0
- package/urlToolkit.js +8 -0
- package/dayjs/index.js +0 -15
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
import { LunarMonth as d } from "./LunarMonth.js";
|
|
2
|
+
import { LunarUtil as r } from "./LunarUtil.js";
|
|
3
|
+
import { ShouXingUtil as u } from "./ShouXingUtil.js";
|
|
4
|
+
import { Solar as f } from "./Solar.js";
|
|
5
|
+
class h {
|
|
6
|
+
_year;
|
|
7
|
+
_ganIndex;
|
|
8
|
+
_zhiIndex;
|
|
9
|
+
_months;
|
|
10
|
+
_jieQiJulianDays;
|
|
11
|
+
static YUAN = ["下", "上", "中"];
|
|
12
|
+
static YUN = [
|
|
13
|
+
"七",
|
|
14
|
+
"八",
|
|
15
|
+
"九",
|
|
16
|
+
"一",
|
|
17
|
+
"二",
|
|
18
|
+
"三",
|
|
19
|
+
"四",
|
|
20
|
+
"五",
|
|
21
|
+
"六"
|
|
22
|
+
];
|
|
23
|
+
static _LEAP_11 = [
|
|
24
|
+
75,
|
|
25
|
+
94,
|
|
26
|
+
170,
|
|
27
|
+
265,
|
|
28
|
+
322,
|
|
29
|
+
398,
|
|
30
|
+
469,
|
|
31
|
+
553,
|
|
32
|
+
583,
|
|
33
|
+
610,
|
|
34
|
+
678,
|
|
35
|
+
735,
|
|
36
|
+
754,
|
|
37
|
+
773,
|
|
38
|
+
849,
|
|
39
|
+
887,
|
|
40
|
+
936,
|
|
41
|
+
1050,
|
|
42
|
+
1069,
|
|
43
|
+
1126,
|
|
44
|
+
1145,
|
|
45
|
+
1164,
|
|
46
|
+
1183,
|
|
47
|
+
1259,
|
|
48
|
+
1278,
|
|
49
|
+
1308,
|
|
50
|
+
1373,
|
|
51
|
+
1403,
|
|
52
|
+
1441,
|
|
53
|
+
1460,
|
|
54
|
+
1498,
|
|
55
|
+
1555,
|
|
56
|
+
1593,
|
|
57
|
+
1612,
|
|
58
|
+
1631,
|
|
59
|
+
1642,
|
|
60
|
+
2033,
|
|
61
|
+
2128,
|
|
62
|
+
2147,
|
|
63
|
+
2242,
|
|
64
|
+
2614,
|
|
65
|
+
2728,
|
|
66
|
+
2910,
|
|
67
|
+
3062,
|
|
68
|
+
3244,
|
|
69
|
+
3339,
|
|
70
|
+
3616,
|
|
71
|
+
3711,
|
|
72
|
+
3730,
|
|
73
|
+
3825,
|
|
74
|
+
4007,
|
|
75
|
+
4159,
|
|
76
|
+
4197,
|
|
77
|
+
4322,
|
|
78
|
+
4341,
|
|
79
|
+
4379,
|
|
80
|
+
4417,
|
|
81
|
+
4531,
|
|
82
|
+
4599,
|
|
83
|
+
4694,
|
|
84
|
+
4713,
|
|
85
|
+
4789,
|
|
86
|
+
4808,
|
|
87
|
+
4971,
|
|
88
|
+
5085,
|
|
89
|
+
5104,
|
|
90
|
+
5161,
|
|
91
|
+
5180,
|
|
92
|
+
5199,
|
|
93
|
+
5294,
|
|
94
|
+
5305,
|
|
95
|
+
5476,
|
|
96
|
+
5677,
|
|
97
|
+
5696,
|
|
98
|
+
5772,
|
|
99
|
+
5791,
|
|
100
|
+
5848,
|
|
101
|
+
5886,
|
|
102
|
+
6049,
|
|
103
|
+
6068,
|
|
104
|
+
6144,
|
|
105
|
+
6163,
|
|
106
|
+
6258,
|
|
107
|
+
6402,
|
|
108
|
+
6440,
|
|
109
|
+
6497,
|
|
110
|
+
6516,
|
|
111
|
+
6630,
|
|
112
|
+
6641,
|
|
113
|
+
6660,
|
|
114
|
+
6679,
|
|
115
|
+
6736,
|
|
116
|
+
6774,
|
|
117
|
+
6850,
|
|
118
|
+
6869,
|
|
119
|
+
6899,
|
|
120
|
+
6918,
|
|
121
|
+
6994,
|
|
122
|
+
7013,
|
|
123
|
+
7032,
|
|
124
|
+
7051,
|
|
125
|
+
7070,
|
|
126
|
+
7089,
|
|
127
|
+
7108,
|
|
128
|
+
7127,
|
|
129
|
+
7146,
|
|
130
|
+
7222,
|
|
131
|
+
7271,
|
|
132
|
+
7290,
|
|
133
|
+
7309,
|
|
134
|
+
7366,
|
|
135
|
+
7385,
|
|
136
|
+
7404,
|
|
137
|
+
7442,
|
|
138
|
+
7461,
|
|
139
|
+
7480,
|
|
140
|
+
7491,
|
|
141
|
+
7499,
|
|
142
|
+
7594,
|
|
143
|
+
7624,
|
|
144
|
+
7643,
|
|
145
|
+
7662,
|
|
146
|
+
7681,
|
|
147
|
+
7719,
|
|
148
|
+
7738,
|
|
149
|
+
7814,
|
|
150
|
+
7863,
|
|
151
|
+
7882,
|
|
152
|
+
7901,
|
|
153
|
+
7939,
|
|
154
|
+
7958,
|
|
155
|
+
7977,
|
|
156
|
+
7996,
|
|
157
|
+
8034,
|
|
158
|
+
8053,
|
|
159
|
+
8072,
|
|
160
|
+
8091,
|
|
161
|
+
8121,
|
|
162
|
+
8159,
|
|
163
|
+
8186,
|
|
164
|
+
8216,
|
|
165
|
+
8235,
|
|
166
|
+
8254,
|
|
167
|
+
8273,
|
|
168
|
+
8311,
|
|
169
|
+
8330,
|
|
170
|
+
8341,
|
|
171
|
+
8349,
|
|
172
|
+
8368,
|
|
173
|
+
8444,
|
|
174
|
+
8463,
|
|
175
|
+
8474,
|
|
176
|
+
8493,
|
|
177
|
+
8531,
|
|
178
|
+
8569,
|
|
179
|
+
8588,
|
|
180
|
+
8626,
|
|
181
|
+
8664,
|
|
182
|
+
8683,
|
|
183
|
+
8694,
|
|
184
|
+
8702,
|
|
185
|
+
8713,
|
|
186
|
+
8721,
|
|
187
|
+
8751,
|
|
188
|
+
8789,
|
|
189
|
+
8808,
|
|
190
|
+
8816,
|
|
191
|
+
8827,
|
|
192
|
+
8846,
|
|
193
|
+
8884,
|
|
194
|
+
8903,
|
|
195
|
+
8922,
|
|
196
|
+
8941,
|
|
197
|
+
8971,
|
|
198
|
+
9036,
|
|
199
|
+
9066,
|
|
200
|
+
9085,
|
|
201
|
+
9104,
|
|
202
|
+
9123,
|
|
203
|
+
9142,
|
|
204
|
+
9161,
|
|
205
|
+
9180,
|
|
206
|
+
9199,
|
|
207
|
+
9218,
|
|
208
|
+
9256,
|
|
209
|
+
9294,
|
|
210
|
+
9313,
|
|
211
|
+
9324,
|
|
212
|
+
9343,
|
|
213
|
+
9362,
|
|
214
|
+
9381,
|
|
215
|
+
9419,
|
|
216
|
+
9438,
|
|
217
|
+
9476,
|
|
218
|
+
9514,
|
|
219
|
+
9533,
|
|
220
|
+
9544,
|
|
221
|
+
9552,
|
|
222
|
+
9563,
|
|
223
|
+
9571,
|
|
224
|
+
9582,
|
|
225
|
+
9601,
|
|
226
|
+
9639,
|
|
227
|
+
9658,
|
|
228
|
+
9666,
|
|
229
|
+
9677,
|
|
230
|
+
9696,
|
|
231
|
+
9734,
|
|
232
|
+
9753,
|
|
233
|
+
9772,
|
|
234
|
+
9791,
|
|
235
|
+
9802,
|
|
236
|
+
9821,
|
|
237
|
+
9886,
|
|
238
|
+
9897,
|
|
239
|
+
9916,
|
|
240
|
+
9935,
|
|
241
|
+
9954,
|
|
242
|
+
9973,
|
|
243
|
+
9992
|
|
244
|
+
];
|
|
245
|
+
static _LEAP_12 = [
|
|
246
|
+
37,
|
|
247
|
+
56,
|
|
248
|
+
113,
|
|
249
|
+
132,
|
|
250
|
+
151,
|
|
251
|
+
189,
|
|
252
|
+
208,
|
|
253
|
+
227,
|
|
254
|
+
246,
|
|
255
|
+
284,
|
|
256
|
+
303,
|
|
257
|
+
341,
|
|
258
|
+
360,
|
|
259
|
+
379,
|
|
260
|
+
417,
|
|
261
|
+
436,
|
|
262
|
+
458,
|
|
263
|
+
477,
|
|
264
|
+
496,
|
|
265
|
+
515,
|
|
266
|
+
534,
|
|
267
|
+
572,
|
|
268
|
+
591,
|
|
269
|
+
629,
|
|
270
|
+
648,
|
|
271
|
+
667,
|
|
272
|
+
697,
|
|
273
|
+
716,
|
|
274
|
+
792,
|
|
275
|
+
811,
|
|
276
|
+
830,
|
|
277
|
+
868,
|
|
278
|
+
906,
|
|
279
|
+
925,
|
|
280
|
+
944,
|
|
281
|
+
963,
|
|
282
|
+
982,
|
|
283
|
+
1001,
|
|
284
|
+
1020,
|
|
285
|
+
1039,
|
|
286
|
+
1058,
|
|
287
|
+
1088,
|
|
288
|
+
1153,
|
|
289
|
+
1202,
|
|
290
|
+
1221,
|
|
291
|
+
1240,
|
|
292
|
+
1297,
|
|
293
|
+
1335,
|
|
294
|
+
1392,
|
|
295
|
+
1411,
|
|
296
|
+
1422,
|
|
297
|
+
1430,
|
|
298
|
+
1517,
|
|
299
|
+
1525,
|
|
300
|
+
1536,
|
|
301
|
+
1574,
|
|
302
|
+
3358,
|
|
303
|
+
3472,
|
|
304
|
+
3806,
|
|
305
|
+
3988,
|
|
306
|
+
4751,
|
|
307
|
+
4941,
|
|
308
|
+
5066,
|
|
309
|
+
5123,
|
|
310
|
+
5275,
|
|
311
|
+
5343,
|
|
312
|
+
5438,
|
|
313
|
+
5457,
|
|
314
|
+
5495,
|
|
315
|
+
5533,
|
|
316
|
+
5552,
|
|
317
|
+
5715,
|
|
318
|
+
5810,
|
|
319
|
+
5829,
|
|
320
|
+
5905,
|
|
321
|
+
5924,
|
|
322
|
+
6421,
|
|
323
|
+
6535,
|
|
324
|
+
6793,
|
|
325
|
+
6812,
|
|
326
|
+
6888,
|
|
327
|
+
6907,
|
|
328
|
+
7002,
|
|
329
|
+
7184,
|
|
330
|
+
7260,
|
|
331
|
+
7279,
|
|
332
|
+
7374,
|
|
333
|
+
7556,
|
|
334
|
+
7746,
|
|
335
|
+
7757,
|
|
336
|
+
7776,
|
|
337
|
+
7833,
|
|
338
|
+
7852,
|
|
339
|
+
7871,
|
|
340
|
+
7966,
|
|
341
|
+
8015,
|
|
342
|
+
8110,
|
|
343
|
+
8129,
|
|
344
|
+
8148,
|
|
345
|
+
8224,
|
|
346
|
+
8243,
|
|
347
|
+
8338,
|
|
348
|
+
8406,
|
|
349
|
+
8425,
|
|
350
|
+
8482,
|
|
351
|
+
8501,
|
|
352
|
+
8520,
|
|
353
|
+
8558,
|
|
354
|
+
8596,
|
|
355
|
+
8607,
|
|
356
|
+
8615,
|
|
357
|
+
8645,
|
|
358
|
+
8740,
|
|
359
|
+
8778,
|
|
360
|
+
8835,
|
|
361
|
+
8865,
|
|
362
|
+
8930,
|
|
363
|
+
8960,
|
|
364
|
+
8979,
|
|
365
|
+
8998,
|
|
366
|
+
9017,
|
|
367
|
+
9055,
|
|
368
|
+
9074,
|
|
369
|
+
9093,
|
|
370
|
+
9112,
|
|
371
|
+
9150,
|
|
372
|
+
9188,
|
|
373
|
+
9237,
|
|
374
|
+
9275,
|
|
375
|
+
9332,
|
|
376
|
+
9351,
|
|
377
|
+
9370,
|
|
378
|
+
9408,
|
|
379
|
+
9427,
|
|
380
|
+
9446,
|
|
381
|
+
9457,
|
|
382
|
+
9465,
|
|
383
|
+
9495,
|
|
384
|
+
9560,
|
|
385
|
+
9590,
|
|
386
|
+
9628,
|
|
387
|
+
9647,
|
|
388
|
+
9685,
|
|
389
|
+
9715,
|
|
390
|
+
9742,
|
|
391
|
+
9780,
|
|
392
|
+
9810,
|
|
393
|
+
9818,
|
|
394
|
+
9829,
|
|
395
|
+
9848,
|
|
396
|
+
9867,
|
|
397
|
+
9905,
|
|
398
|
+
9924,
|
|
399
|
+
9943,
|
|
400
|
+
9962,
|
|
401
|
+
1e4
|
|
402
|
+
];
|
|
403
|
+
static _CACHE_YEAR = null;
|
|
404
|
+
static fromYear(t) {
|
|
405
|
+
let i;
|
|
406
|
+
return !h._CACHE_YEAR || h._CACHE_YEAR.getYear() != t ? (i = new h(t), h._CACHE_YEAR = i) : i = h._CACHE_YEAR, i;
|
|
407
|
+
}
|
|
408
|
+
constructor(t) {
|
|
409
|
+
this._year = t, this._months = [], this._jieQiJulianDays = [];
|
|
410
|
+
const i = t - 4;
|
|
411
|
+
let s = i % 10, n = i % 12;
|
|
412
|
+
s < 0 && (s += 10), n < 0 && (n += 12), this._ganIndex = s, this._zhiIndex = n, this.compute();
|
|
413
|
+
}
|
|
414
|
+
compute() {
|
|
415
|
+
const t = [], i = [], s = [], n = [];
|
|
416
|
+
let e, _;
|
|
417
|
+
const c = this._year;
|
|
418
|
+
let l = Math.floor((c - 2e3) * 365.2422 + 180), g = Math.floor((l - 355 + 183) / 365.2422) * 365.2422 + 355;
|
|
419
|
+
for (u.calcQi(g) > l && (g -= 365.2422), e = 0; e < 26; e++)
|
|
420
|
+
t.push(u.calcQi(g + 15.2184 * e));
|
|
421
|
+
for (e = 0, _ = r.JIE_QI_IN_USE.length; e < _; e++)
|
|
422
|
+
e === 0 ? l = u.qiAccurate2(t[0] - 15.2184) : e <= 26 ? l = u.qiAccurate2(t[e - 1]) : l = u.qiAccurate2(t[25] + 15.2184 * (e - 26)), this._jieQiJulianDays.push(l + f.J2000);
|
|
423
|
+
for (g = u.calcShuo(t[0]), g > t[0] && (g -= 29.53), e = 0; e < 16; e++)
|
|
424
|
+
i.push(u.calcShuo(g + 29.5306 * e));
|
|
425
|
+
for (e = 0; e < 15; e++)
|
|
426
|
+
s.push(Math.floor(i[e + 1] - i[e])), n.push(e);
|
|
427
|
+
const O = c - 1;
|
|
428
|
+
let I = 16;
|
|
429
|
+
if (h._LEAP_11.indexOf(c) > -1)
|
|
430
|
+
I = 13;
|
|
431
|
+
else if (h._LEAP_12.indexOf(c) > -1)
|
|
432
|
+
I = 14;
|
|
433
|
+
else if (i[13] <= t[24]) {
|
|
434
|
+
for (e = 1; i[e + 1] > t[2 * e] && e < 13; )
|
|
435
|
+
e++;
|
|
436
|
+
I = e;
|
|
437
|
+
}
|
|
438
|
+
for (_ = I; _ < 15; _++)
|
|
439
|
+
n[_] -= 1;
|
|
440
|
+
const m = [11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
441
|
+
let y = -1, Z = -1, S = O;
|
|
442
|
+
for (e = 0; e < 15; e++) {
|
|
443
|
+
const a = i[e] + f.J2000, P = n[e];
|
|
444
|
+
let o = m[P % 12];
|
|
445
|
+
1724360 <= a && a < 1729794 || 1807724 <= a && a < 1808699 ? o = m[(P + 1) % 12] : (a == 1729794 || a == 1808699) && (o = 12), y == -1 && (y = o, Z = o), o < y && (S += 1, Z = 1), y = o, e == I ? o = -o : (a == 1729794 || a == 1808699) && (o = -11), this._months.push(
|
|
446
|
+
new d(S, o, s[e], i[e] + f.J2000, Z)
|
|
447
|
+
), Z++;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
getYear() {
|
|
451
|
+
return this._year;
|
|
452
|
+
}
|
|
453
|
+
getGanIndex() {
|
|
454
|
+
return this._ganIndex;
|
|
455
|
+
}
|
|
456
|
+
getZhiIndex() {
|
|
457
|
+
return this._zhiIndex;
|
|
458
|
+
}
|
|
459
|
+
getGan() {
|
|
460
|
+
return r.GAN[this._ganIndex + 1];
|
|
461
|
+
}
|
|
462
|
+
getZhi() {
|
|
463
|
+
return r.ZHI[this._zhiIndex + 1];
|
|
464
|
+
}
|
|
465
|
+
getGanZhi() {
|
|
466
|
+
return this.getGan() + this.getZhi();
|
|
467
|
+
}
|
|
468
|
+
getJieQiJulianDays() {
|
|
469
|
+
return this._jieQiJulianDays;
|
|
470
|
+
}
|
|
471
|
+
getDayCount() {
|
|
472
|
+
let t = 0;
|
|
473
|
+
for (let i = 0, s = this._months.length; i < s; i++) {
|
|
474
|
+
const n = this._months[i];
|
|
475
|
+
n.getYear() == this._year && (t += n.getDayCount());
|
|
476
|
+
}
|
|
477
|
+
return t;
|
|
478
|
+
}
|
|
479
|
+
getMonths() {
|
|
480
|
+
return this._months;
|
|
481
|
+
}
|
|
482
|
+
getMonthsInYear() {
|
|
483
|
+
const t = [];
|
|
484
|
+
for (let i = 0, s = this._months.length; i < s; i++) {
|
|
485
|
+
const n = this._months[i];
|
|
486
|
+
n.getYear() == this._year && t.push(n);
|
|
487
|
+
}
|
|
488
|
+
return t;
|
|
489
|
+
}
|
|
490
|
+
getMonth(t) {
|
|
491
|
+
for (let i = 0, s = this._months.length; i < s; i++) {
|
|
492
|
+
const n = this._months[i];
|
|
493
|
+
if (n.getYear() == this._year && n.getMonth() == t)
|
|
494
|
+
return n;
|
|
495
|
+
}
|
|
496
|
+
return null;
|
|
497
|
+
}
|
|
498
|
+
getLeapMonth() {
|
|
499
|
+
for (let t = 0, i = this._months.length; t < i; t++) {
|
|
500
|
+
const s = this._months[t];
|
|
501
|
+
if (s.getYear() == this._year && s.isLeap())
|
|
502
|
+
return Math.abs(s.getMonth());
|
|
503
|
+
}
|
|
504
|
+
return 0;
|
|
505
|
+
}
|
|
506
|
+
toString() {
|
|
507
|
+
return `${this.getYear()}`;
|
|
508
|
+
}
|
|
509
|
+
toFullString() {
|
|
510
|
+
return `${this.getYear()}年`;
|
|
511
|
+
}
|
|
512
|
+
_getZaoByGan(t, i) {
|
|
513
|
+
const s = this.getMonth(1);
|
|
514
|
+
if (s == null)
|
|
515
|
+
return "";
|
|
516
|
+
let n = t - f.fromJulianDay(s.getFirstJulianDay()).getLunar().getDayGanIndex();
|
|
517
|
+
return n < 0 && (n += 10), i.replace("几", r.NUMBER[n + 1]);
|
|
518
|
+
}
|
|
519
|
+
_getZaoByZhi(t, i) {
|
|
520
|
+
const s = this.getMonth(1);
|
|
521
|
+
if (s == null)
|
|
522
|
+
return "";
|
|
523
|
+
let n = t - f.fromJulianDay(s.getFirstJulianDay()).getLunar().getDayZhiIndex();
|
|
524
|
+
return n < 0 && (n += 12), i.replace("几", r.NUMBER[n + 1]);
|
|
525
|
+
}
|
|
526
|
+
getTouLiang() {
|
|
527
|
+
return this._getZaoByZhi(0, "几鼠偷粮");
|
|
528
|
+
}
|
|
529
|
+
getCaoZi() {
|
|
530
|
+
return this._getZaoByZhi(0, "草子几分");
|
|
531
|
+
}
|
|
532
|
+
getGengTian() {
|
|
533
|
+
return this._getZaoByZhi(1, "几牛耕田");
|
|
534
|
+
}
|
|
535
|
+
getHuaShou() {
|
|
536
|
+
return this._getZaoByZhi(3, "花收几分");
|
|
537
|
+
}
|
|
538
|
+
getZhiShui() {
|
|
539
|
+
return this._getZaoByZhi(4, "几龙治水");
|
|
540
|
+
}
|
|
541
|
+
getTuoGu() {
|
|
542
|
+
return this._getZaoByZhi(6, "几马驮谷");
|
|
543
|
+
}
|
|
544
|
+
getQiangMi() {
|
|
545
|
+
return this._getZaoByZhi(9, "几鸡抢米");
|
|
546
|
+
}
|
|
547
|
+
getKanCan() {
|
|
548
|
+
return this._getZaoByZhi(9, "几姑看蚕");
|
|
549
|
+
}
|
|
550
|
+
getGongZhu() {
|
|
551
|
+
return this._getZaoByZhi(11, "几屠共猪");
|
|
552
|
+
}
|
|
553
|
+
getJiaTian() {
|
|
554
|
+
return this._getZaoByGan(0, "甲田几分");
|
|
555
|
+
}
|
|
556
|
+
getFenBing() {
|
|
557
|
+
return this._getZaoByGan(2, "几人分饼");
|
|
558
|
+
}
|
|
559
|
+
getDeJin() {
|
|
560
|
+
return this._getZaoByGan(7, "几日得金");
|
|
561
|
+
}
|
|
562
|
+
getRenBing() {
|
|
563
|
+
return this._getZaoByGan(2, this._getZaoByZhi(2, "几人几丙"));
|
|
564
|
+
}
|
|
565
|
+
getRenChu() {
|
|
566
|
+
return this._getZaoByGan(3, this._getZaoByZhi(2, "几人几锄"));
|
|
567
|
+
}
|
|
568
|
+
getYuan() {
|
|
569
|
+
return h.YUAN[Math.floor((this._year + 2696) / 60) % 3] + "元";
|
|
570
|
+
}
|
|
571
|
+
getYun() {
|
|
572
|
+
return h.YUN[Math.floor((this._year + 2696) / 20) % 9] + "运";
|
|
573
|
+
}
|
|
574
|
+
getPositionXi() {
|
|
575
|
+
return r.POSITION_XI[this._ganIndex + 1];
|
|
576
|
+
}
|
|
577
|
+
getPositionXiDesc() {
|
|
578
|
+
return r.POSITION_DESC[this.getPositionXi()];
|
|
579
|
+
}
|
|
580
|
+
getPositionYangGui() {
|
|
581
|
+
return r.POSITION_YANG_GUI[this._ganIndex + 1];
|
|
582
|
+
}
|
|
583
|
+
getPositionYangGuiDesc() {
|
|
584
|
+
return r.POSITION_DESC[this.getPositionYangGui()];
|
|
585
|
+
}
|
|
586
|
+
getPositionYinGui() {
|
|
587
|
+
return r.POSITION_YIN_GUI[this._ganIndex + 1];
|
|
588
|
+
}
|
|
589
|
+
getPositionYinGuiDesc() {
|
|
590
|
+
return r.POSITION_DESC[this.getPositionYinGui()];
|
|
591
|
+
}
|
|
592
|
+
getPositionFu(t = 2) {
|
|
593
|
+
return (t == 1 ? r.POSITION_FU : r.POSITION_FU_2)[this._ganIndex + 1];
|
|
594
|
+
}
|
|
595
|
+
getPositionFuDesc(t = 2) {
|
|
596
|
+
return r.POSITION_DESC[this.getPositionFu(t)];
|
|
597
|
+
}
|
|
598
|
+
getPositionCai() {
|
|
599
|
+
return r.POSITION_CAI[this._ganIndex + 1];
|
|
600
|
+
}
|
|
601
|
+
getPositionCaiDesc() {
|
|
602
|
+
return r.POSITION_DESC[this.getPositionCai()];
|
|
603
|
+
}
|
|
604
|
+
getPositionTaiSui() {
|
|
605
|
+
return r.POSITION_TAI_SUI_YEAR[this._zhiIndex];
|
|
606
|
+
}
|
|
607
|
+
getPositionTaiSuiDesc() {
|
|
608
|
+
return r.POSITION_DESC[this.getPositionTaiSui()];
|
|
609
|
+
}
|
|
610
|
+
next(t) {
|
|
611
|
+
return h.fromYear(this._year + t);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
export {
|
|
615
|
+
h as LunarYear
|
|
616
|
+
};
|