@unicom-cloud/utils 0.1.15 → 0.1.16
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/lunar/lib/Holiday.js +2 -6
- package/lunar/lib/HolidayUtil.js +113 -99
- package/lunar/lib/I18n.js +395 -975
- package/lunar/lib/JieQi.js +12 -16
- package/lunar/lib/Lunar.js +224 -672
- package/lunar/lib/LunarMonth.js +35 -98
- package/lunar/lib/LunarTime.js +24 -103
- package/lunar/lib/LunarUtil.js +426 -1728
- package/lunar/lib/LunarYear.js +473 -566
- package/lunar/lib/ShouXingUtil.js +6714 -6690
- package/lunar/lib/Solar.js +24 -49
- package/lunar/lib/SolarHalfYear.js +0 -2
- package/lunar/lib/SolarMonth.js +4 -6
- package/lunar/lib/SolarSeason.js +0 -2
- package/lunar/lib/SolarUtil.js +238 -226
- package/lunar/lib/SolarWeek.js +7 -11
- package/lunar/lib/SolarYear.js +0 -1
- package/package.json +1 -1
- package/snapdom/src/core/prepare.js +21 -21
- package/snapdom/src/modules/fonts.js +99 -91
- package/snapdom/src/modules/pseudo.js +58 -66
- package/tinycolor/src/conversion.js +1 -1
- package/tinycolor/src/index.js +2 -19
- package/turbo-stream/src/encode.js +5 -8
- package/turbo-stream/src/shared.js +117 -119
- package/types/lunar/lib/Lunar.d.ts +0 -98
- package/types/lunar/lib/LunarMonth.d.ts +0 -12
- package/types/lunar/lib/LunarTime.d.ts +0 -22
- package/types/lunar/lib/LunarUtil.d.ts +0 -90
- package/types/lunar/lib/LunarYear.d.ts +0 -30
- package/types/lunar/lib/Solar.d.ts +0 -5
- package/types/snapdom/src/modules/pseudo.d.ts +1 -1
- package/types/tinycolor/src/conversion.d.ts +1 -1
package/lunar/lib/Lunar.js
CHANGED
|
@@ -1,87 +1,59 @@
|
|
|
1
|
-
import { I18n as
|
|
2
|
-
import { JieQi as
|
|
3
|
-
import { LunarTime as
|
|
4
|
-
import { LunarUtil as
|
|
5
|
-
import { LunarYear as
|
|
6
|
-
import { Solar as
|
|
7
|
-
import { SolarUtil as
|
|
8
|
-
class
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
_dayZhiIndex;
|
|
19
|
-
_dayGanIndexExact;
|
|
20
|
-
_dayZhiIndexExact;
|
|
21
|
-
_dayGanIndexExact2;
|
|
22
|
-
_dayZhiIndexExact2;
|
|
23
|
-
_monthGanIndex;
|
|
24
|
-
_monthZhiIndex;
|
|
25
|
-
_monthGanIndexExact;
|
|
26
|
-
_monthZhiIndexExact;
|
|
27
|
-
_yearGanIndex;
|
|
28
|
-
_yearZhiIndex;
|
|
29
|
-
_yearGanIndexByLiChun;
|
|
30
|
-
_yearZhiIndexByLiChun;
|
|
31
|
-
_yearGanIndexExact;
|
|
32
|
-
_yearZhiIndexExact;
|
|
33
|
-
_weekIndex;
|
|
34
|
-
_jieQi;
|
|
35
|
-
_jieQiList;
|
|
36
|
-
_solar;
|
|
37
|
-
static fromYmd(t, n, i) {
|
|
38
|
-
return _.fromYmdHms(t, n, i, 0, 0, 0);
|
|
39
|
-
}
|
|
40
|
-
static fromYmdHms(t, n, i, a, r, g) {
|
|
41
|
-
let I = Z.fromYear(t);
|
|
42
|
-
const u = I.getMonth(n);
|
|
43
|
-
if (u == null)
|
|
44
|
-
throw new Error(`wrong lunar year ${t} month ${n}`);
|
|
45
|
-
if (i < 1)
|
|
1
|
+
import { I18n as _ } from "./I18n.js";
|
|
2
|
+
import { JieQi as E } from "./JieQi.js";
|
|
3
|
+
import { LunarTime as l } from "./LunarTime.js";
|
|
4
|
+
import { LunarUtil as h } from "./LunarUtil.js";
|
|
5
|
+
import { LunarYear as G } from "./LunarYear.js";
|
|
6
|
+
import { Solar as u } from "./Solar.js";
|
|
7
|
+
import { SolarUtil as Y } from "./SolarUtil.js";
|
|
8
|
+
class I {
|
|
9
|
+
static fromYmd(t, e, n) {
|
|
10
|
+
return I.fromYmdHms(t, e, n, 0, 0, 0);
|
|
11
|
+
}
|
|
12
|
+
static fromYmdHms(t, e, n, i, r, s) {
|
|
13
|
+
let g = G.fromYear(t);
|
|
14
|
+
const d = g.getMonth(e);
|
|
15
|
+
if (d == null)
|
|
16
|
+
throw new Error(`wrong lunar year ${t} month ${e}`);
|
|
17
|
+
if (n < 1)
|
|
46
18
|
throw new Error("lunar day must bigger than 0");
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
19
|
+
const a = d.getDayCount();
|
|
20
|
+
if (n > a)
|
|
49
21
|
throw new Error(
|
|
50
|
-
`only ${
|
|
22
|
+
`only ${a} days in lunar year ${t} month ${e}`
|
|
51
23
|
);
|
|
52
|
-
const o =
|
|
24
|
+
const o = u.fromJulianDay(d.getFirstJulianDay() + n - 1), x = u.fromYmdHms(
|
|
53
25
|
o.getYear(),
|
|
54
26
|
o.getMonth(),
|
|
55
27
|
o.getDay(),
|
|
56
|
-
|
|
28
|
+
i,
|
|
57
29
|
r,
|
|
58
|
-
|
|
30
|
+
s
|
|
59
31
|
);
|
|
60
|
-
return o.getYear() !== t && (
|
|
32
|
+
return o.getYear() !== t && (g = G.fromYear(o.getYear())), new I(
|
|
61
33
|
t,
|
|
34
|
+
e,
|
|
62
35
|
n,
|
|
63
36
|
i,
|
|
64
|
-
a,
|
|
65
37
|
r,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
38
|
+
s,
|
|
39
|
+
x,
|
|
40
|
+
g
|
|
69
41
|
);
|
|
70
42
|
}
|
|
71
43
|
static fromSolar(t) {
|
|
72
|
-
let
|
|
73
|
-
const r =
|
|
74
|
-
for (let
|
|
75
|
-
const
|
|
76
|
-
if (o <
|
|
77
|
-
|
|
44
|
+
let e = 0, n = 0, i = 0;
|
|
45
|
+
const r = G.fromYear(t.getYear()), s = r.getMonths();
|
|
46
|
+
for (let g = 0, d = s.length; g < d; g++) {
|
|
47
|
+
const a = s[g], o = t.subtract(u.fromJulianDay(a.getFirstJulianDay()));
|
|
48
|
+
if (o < a.getDayCount()) {
|
|
49
|
+
e = a.getYear(), n = a.getMonth(), i = o + 1;
|
|
78
50
|
break;
|
|
79
51
|
}
|
|
80
52
|
}
|
|
81
|
-
return new
|
|
53
|
+
return new I(
|
|
54
|
+
e,
|
|
82
55
|
n,
|
|
83
56
|
i,
|
|
84
|
-
a,
|
|
85
57
|
t.getHour(),
|
|
86
58
|
t.getMinute(),
|
|
87
59
|
t.getSecond(),
|
|
@@ -90,73 +62,73 @@ class _ {
|
|
|
90
62
|
);
|
|
91
63
|
}
|
|
92
64
|
static fromDate(t) {
|
|
93
|
-
return
|
|
65
|
+
return I.fromSolar(u.fromDate(t));
|
|
94
66
|
}
|
|
95
|
-
static _computeJieQi(t,
|
|
96
|
-
const
|
|
97
|
-
for (let
|
|
98
|
-
const
|
|
99
|
-
t.jieQiList.push(
|
|
67
|
+
static _computeJieQi(t, e) {
|
|
68
|
+
const n = e.getJieQiJulianDays();
|
|
69
|
+
for (let i = 0, r = h.JIE_QI_IN_USE.length; i < r; i++) {
|
|
70
|
+
const s = h.JIE_QI_IN_USE[i];
|
|
71
|
+
t.jieQiList.push(s), t.jieQi[s] = u.fromJulianDay(n[i]);
|
|
100
72
|
}
|
|
101
73
|
}
|
|
102
|
-
static _computeYear(t,
|
|
103
|
-
const
|
|
104
|
-
let r =
|
|
105
|
-
r < 0 && (r += 10),
|
|
106
|
-
let
|
|
107
|
-
const
|
|
108
|
-
let m = t.jieQi[
|
|
109
|
-
m.getYear() !=
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
static _computeMonth(t,
|
|
114
|
-
let
|
|
115
|
-
const
|
|
116
|
-
let
|
|
117
|
-
for (
|
|
118
|
-
r = t.jieQi[
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
74
|
+
static _computeYear(t, e, n) {
|
|
75
|
+
const i = n - 4;
|
|
76
|
+
let r = i % 10, s = i % 12;
|
|
77
|
+
r < 0 && (r += 10), s < 0 && (s += 12);
|
|
78
|
+
let g = r, d = s, a = r, o = s;
|
|
79
|
+
const x = e.getYear(), c = e.toYmd(), y = e.toYmdHms();
|
|
80
|
+
let m = t.jieQi[_.getMessage("jq.liChun")];
|
|
81
|
+
m.getYear() != x && (m = t.jieQi.LI_CHUN);
|
|
82
|
+
const Z = m.toYmd(), f = m.toYmdHms();
|
|
83
|
+
n === x ? (c < Z && (g--, d--), y < f && (a--, o--)) : n < x && (c >= Z && (g++, d++), y >= f && (a++, o++)), t.yearGanIndex = r, t.yearZhiIndex = s, t.yearGanIndexByLiChun = (g < 0 ? g + 10 : g) % 10, t.yearZhiIndexByLiChun = (d < 0 ? d + 12 : d) % 12, t.yearGanIndexExact = (a < 0 ? a + 10 : a) % 10, t.yearZhiIndexExact = (o < 0 ? o + 12 : o) % 12;
|
|
84
|
+
}
|
|
85
|
+
static _computeMonth(t, e) {
|
|
86
|
+
let n = null, i, r;
|
|
87
|
+
const s = e.toYmd(), g = e.toYmdHms(), d = h.JIE_QI_IN_USE.length;
|
|
88
|
+
let a = -3;
|
|
89
|
+
for (i = 0; i < d; i += 2) {
|
|
90
|
+
r = t.jieQi[h.JIE_QI_IN_USE[i]];
|
|
91
|
+
const x = n == null ? s : n.toYmd();
|
|
92
|
+
if (s >= x && s < r.toYmd())
|
|
121
93
|
break;
|
|
122
|
-
|
|
94
|
+
n = r, a++;
|
|
123
95
|
}
|
|
124
|
-
let o = ((t.yearGanIndexByLiChun + (
|
|
125
|
-
for (t.monthGanIndex = ((
|
|
126
|
-
r = t.jieQi[
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
96
|
+
let o = ((t.yearGanIndexByLiChun + (a < 0 ? 1 : 0)) % 5 + 1) * 2 % 10;
|
|
97
|
+
for (t.monthGanIndex = ((a < 0 ? a + 10 : a) + o) % 10, t.monthZhiIndex = ((a < 0 ? a + 12 : a) + h.BASE_MONTH_ZHI_INDEX) % 12, n = null, a = -3, i = 0; i < d; i += 2) {
|
|
98
|
+
r = t.jieQi[h.JIE_QI_IN_USE[i]];
|
|
99
|
+
const x = n == null ? g : n.toYmdHms();
|
|
100
|
+
if (g >= x && g < r.toYmdHms())
|
|
129
101
|
break;
|
|
130
|
-
|
|
102
|
+
n = r, a++;
|
|
131
103
|
}
|
|
132
|
-
o = ((t.yearGanIndexExact + (
|
|
104
|
+
o = ((t.yearGanIndexExact + (a < 0 ? 1 : 0)) % 5 + 1) * 2 % 10, t.monthGanIndexExact = ((a < 0 ? a + 10 : a) + o) % 10, t.monthZhiIndexExact = ((a < 0 ? a + 12 : a) + h.BASE_MONTH_ZHI_INDEX) % 12;
|
|
133
105
|
}
|
|
134
|
-
static _computeDay(t, n, i
|
|
135
|
-
const r =
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
106
|
+
static _computeDay(t, e, n, i) {
|
|
107
|
+
const r = u.fromYmdHms(
|
|
108
|
+
e.getYear(),
|
|
109
|
+
e.getMonth(),
|
|
110
|
+
e.getDay(),
|
|
139
111
|
12,
|
|
140
112
|
0,
|
|
141
113
|
0
|
|
142
|
-
),
|
|
143
|
-
t.dayGanIndex =
|
|
144
|
-
let
|
|
145
|
-
t.dayGanIndexExact2 =
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
static _computeTime(t,
|
|
150
|
-
const
|
|
151
|
-
(
|
|
114
|
+
), s = Math.floor(r.getJulianDay()) - 11, g = s % 10, d = s % 12;
|
|
115
|
+
t.dayGanIndex = g, t.dayZhiIndex = d;
|
|
116
|
+
let a = g, o = d;
|
|
117
|
+
t.dayGanIndexExact2 = a, t.dayZhiIndexExact2 = o;
|
|
118
|
+
const x = (n < 10 ? "0" : "") + n + ":" + (i < 10 ? "0" : "") + i;
|
|
119
|
+
x >= "23:00" && x <= "23:59" && (a++, a >= 10 && (a -= 10), o++, o >= 12 && (o -= 12)), t.dayGanIndexExact = a, t.dayZhiIndexExact = o;
|
|
120
|
+
}
|
|
121
|
+
static _computeTime(t, e, n) {
|
|
122
|
+
const i = h.getTimeZhiIndex(
|
|
123
|
+
(e < 10 ? "0" : "") + e + ":" + (n < 10 ? "0" : "") + n
|
|
152
124
|
);
|
|
153
|
-
t.timeZhiIndex =
|
|
125
|
+
t.timeZhiIndex = i, t.timeGanIndex = (t.dayGanIndexExact % 5 * 2 + i) % 10;
|
|
154
126
|
}
|
|
155
|
-
static _computeWeek(t,
|
|
156
|
-
t.weekIndex =
|
|
127
|
+
static _computeWeek(t, e) {
|
|
128
|
+
t.weekIndex = e.getWeek();
|
|
157
129
|
}
|
|
158
|
-
static _compute(t, n, i,
|
|
159
|
-
const
|
|
130
|
+
static _compute(t, e, n, i, r) {
|
|
131
|
+
const s = {
|
|
160
132
|
timeGanIndex: 0,
|
|
161
133
|
timeZhiIndex: 0,
|
|
162
134
|
dayGanIndex: 0,
|
|
@@ -179,11 +151,11 @@ class _ {
|
|
|
179
151
|
jieQi: {},
|
|
180
152
|
jieQiList: []
|
|
181
153
|
};
|
|
182
|
-
return
|
|
154
|
+
return I._computeJieQi(s, r), I._computeYear(s, i, t), I._computeMonth(s, i), I._computeDay(s, i, e, n), I._computeTime(s, e, n), I._computeWeek(s, i), s;
|
|
183
155
|
}
|
|
184
|
-
constructor(t, n, i,
|
|
185
|
-
const
|
|
186
|
-
this._year = t, this._month =
|
|
156
|
+
constructor(t, e, n, i, r, s, g, d) {
|
|
157
|
+
const a = I._compute(t, i, r, g, d);
|
|
158
|
+
this._year = t, this._month = e, this._day = n, this._hour = i, this._minute = r, this._second = s, this._timeGanIndex = a.timeGanIndex, this._timeZhiIndex = a.timeZhiIndex, this._dayGanIndex = a.dayGanIndex, this._dayZhiIndex = a.dayZhiIndex, this._dayGanIndexExact = a.dayGanIndexExact, this._dayZhiIndexExact = a.dayZhiIndexExact, this._dayGanIndexExact2 = a.dayGanIndexExact2, this._dayZhiIndexExact2 = a.dayZhiIndexExact2, this._monthGanIndex = a.monthGanIndex, this._monthZhiIndex = a.monthZhiIndex, this._monthGanIndexExact = a.monthGanIndexExact, this._monthZhiIndexExact = a.monthZhiIndexExact, this._yearGanIndex = a.yearGanIndex, this._yearZhiIndex = a.yearZhiIndex, this._yearGanIndexByLiChun = a.yearGanIndexByLiChun, this._yearZhiIndexByLiChun = a.yearZhiIndexByLiChun, this._yearGanIndexExact = a.yearGanIndexExact, this._yearZhiIndexExact = a.yearZhiIndexExact, this._weekIndex = a.weekIndex, this._jieQi = a.jieQi, this._jieQiList = a.jieQiList, this._solar = g;
|
|
187
159
|
}
|
|
188
160
|
getYear() {
|
|
189
161
|
return this._year;
|
|
@@ -264,22 +236,22 @@ class _ {
|
|
|
264
236
|
return this.getYearZhi();
|
|
265
237
|
}
|
|
266
238
|
getYearGan() {
|
|
267
|
-
return
|
|
239
|
+
return h.GAN[this._yearGanIndex + 1];
|
|
268
240
|
}
|
|
269
241
|
getYearGanByLiChun() {
|
|
270
|
-
return
|
|
242
|
+
return h.GAN[this._yearGanIndexByLiChun + 1];
|
|
271
243
|
}
|
|
272
244
|
getYearGanExact() {
|
|
273
|
-
return
|
|
245
|
+
return h.GAN[this._yearGanIndexExact + 1];
|
|
274
246
|
}
|
|
275
247
|
getYearZhi() {
|
|
276
|
-
return
|
|
248
|
+
return h.ZHI[this._yearZhiIndex + 1];
|
|
277
249
|
}
|
|
278
250
|
getYearZhiByLiChun() {
|
|
279
|
-
return
|
|
251
|
+
return h.ZHI[this._yearZhiIndexByLiChun + 1];
|
|
280
252
|
}
|
|
281
253
|
getYearZhiExact() {
|
|
282
|
-
return
|
|
254
|
+
return h.ZHI[this._yearZhiIndexExact + 1];
|
|
283
255
|
}
|
|
284
256
|
getYearInGanZhi() {
|
|
285
257
|
return this.getYearGan() + this.getYearZhi();
|
|
@@ -291,16 +263,16 @@ class _ {
|
|
|
291
263
|
return this.getYearGanExact() + this.getYearZhiExact();
|
|
292
264
|
}
|
|
293
265
|
getMonthGan() {
|
|
294
|
-
return
|
|
266
|
+
return h.GAN[this._monthGanIndex + 1];
|
|
295
267
|
}
|
|
296
268
|
getMonthGanExact() {
|
|
297
|
-
return
|
|
269
|
+
return h.GAN[this._monthGanIndexExact + 1];
|
|
298
270
|
}
|
|
299
271
|
getMonthZhi() {
|
|
300
|
-
return
|
|
272
|
+
return h.ZHI[this._monthZhiIndex + 1];
|
|
301
273
|
}
|
|
302
274
|
getMonthZhiExact() {
|
|
303
|
-
return
|
|
275
|
+
return h.ZHI[this._monthZhiIndexExact + 1];
|
|
304
276
|
}
|
|
305
277
|
getMonthInGanZhi() {
|
|
306
278
|
return this.getMonthGan() + this.getMonthZhi();
|
|
@@ -309,22 +281,22 @@ class _ {
|
|
|
309
281
|
return this.getMonthGanExact() + this.getMonthZhiExact();
|
|
310
282
|
}
|
|
311
283
|
getDayGan() {
|
|
312
|
-
return
|
|
284
|
+
return h.GAN[this._dayGanIndex + 1];
|
|
313
285
|
}
|
|
314
286
|
getDayGanExact() {
|
|
315
|
-
return
|
|
287
|
+
return h.GAN[this._dayGanIndexExact + 1];
|
|
316
288
|
}
|
|
317
289
|
getDayGanExact2() {
|
|
318
|
-
return
|
|
290
|
+
return h.GAN[this._dayGanIndexExact2 + 1];
|
|
319
291
|
}
|
|
320
292
|
getDayZhi() {
|
|
321
|
-
return
|
|
293
|
+
return h.ZHI[this._dayZhiIndex + 1];
|
|
322
294
|
}
|
|
323
295
|
getDayZhiExact() {
|
|
324
|
-
return
|
|
296
|
+
return h.ZHI[this._dayZhiIndexExact + 1];
|
|
325
297
|
}
|
|
326
298
|
getDayZhiExact2() {
|
|
327
|
-
return
|
|
299
|
+
return h.ZHI[this._dayZhiIndexExact2 + 1];
|
|
328
300
|
}
|
|
329
301
|
getDayInGanZhi() {
|
|
330
302
|
return this.getDayGan() + this.getDayZhi();
|
|
@@ -336,10 +308,10 @@ class _ {
|
|
|
336
308
|
return this.getDayGanExact2() + this.getDayZhiExact2();
|
|
337
309
|
}
|
|
338
310
|
getTimeGan() {
|
|
339
|
-
return
|
|
311
|
+
return h.GAN[this._timeGanIndex + 1];
|
|
340
312
|
}
|
|
341
313
|
getTimeZhi() {
|
|
342
|
-
return
|
|
314
|
+
return h.ZHI[this._timeZhiIndex + 1];
|
|
343
315
|
}
|
|
344
316
|
getTimeInGanZhi() {
|
|
345
317
|
return this.getTimeGan() + this.getTimeZhi();
|
|
@@ -348,240 +320,41 @@ class _ {
|
|
|
348
320
|
return this.getYearShengXiao();
|
|
349
321
|
}
|
|
350
322
|
getYearShengXiao() {
|
|
351
|
-
return
|
|
323
|
+
return h.SHENGXIAO[this._yearZhiIndex + 1];
|
|
352
324
|
}
|
|
353
325
|
getYearShengXiaoByLiChun() {
|
|
354
|
-
return
|
|
326
|
+
return h.SHENGXIAO[this._yearZhiIndexByLiChun + 1];
|
|
355
327
|
}
|
|
356
328
|
getYearShengXiaoExact() {
|
|
357
|
-
return
|
|
329
|
+
return h.SHENGXIAO[this._yearZhiIndexExact + 1];
|
|
358
330
|
}
|
|
359
331
|
getMonthShengXiao() {
|
|
360
|
-
return
|
|
332
|
+
return h.SHENGXIAO[this._monthZhiIndex + 1];
|
|
361
333
|
}
|
|
362
334
|
getMonthShengXiaoExact() {
|
|
363
|
-
return
|
|
335
|
+
return h.SHENGXIAO[this._monthZhiIndexExact + 1];
|
|
364
336
|
}
|
|
365
337
|
getDayShengXiao() {
|
|
366
|
-
return
|
|
338
|
+
return h.SHENGXIAO[this._dayZhiIndex + 1];
|
|
367
339
|
}
|
|
368
340
|
getTimeShengXiao() {
|
|
369
|
-
return
|
|
341
|
+
return h.SHENGXIAO[this._timeZhiIndex + 1];
|
|
370
342
|
}
|
|
371
343
|
getYearInChinese() {
|
|
372
344
|
const t = this._year + "";
|
|
373
|
-
let
|
|
374
|
-
const
|
|
375
|
-
for (let
|
|
376
|
-
const
|
|
377
|
-
|
|
345
|
+
let e = "";
|
|
346
|
+
const n = 48;
|
|
347
|
+
for (let i = 0, r = t.length; i < r; i++) {
|
|
348
|
+
const s = t.charCodeAt(i);
|
|
349
|
+
e += h.NUMBER[s - n];
|
|
378
350
|
}
|
|
379
|
-
return
|
|
351
|
+
return e;
|
|
380
352
|
}
|
|
381
353
|
getMonthInChinese() {
|
|
382
|
-
return (this._month < 0 ? "闰" : "") +
|
|
354
|
+
return (this._month < 0 ? "闰" : "") + h.MONTH[Math.abs(this._month)];
|
|
383
355
|
}
|
|
384
356
|
getDayInChinese() {
|
|
385
|
-
return
|
|
386
|
-
}
|
|
387
|
-
getPengZuGan() {
|
|
388
|
-
return e.PENGZU_GAN[this._dayGanIndex + 1];
|
|
389
|
-
}
|
|
390
|
-
getPengZuZhi() {
|
|
391
|
-
return e.PENGZU_ZHI[this._dayZhiIndex + 1];
|
|
392
|
-
}
|
|
393
|
-
getPositionXi() {
|
|
394
|
-
return this.getDayPositionXi();
|
|
395
|
-
}
|
|
396
|
-
getPositionXiDesc() {
|
|
397
|
-
return this.getDayPositionXiDesc();
|
|
398
|
-
}
|
|
399
|
-
getPositionYangGui() {
|
|
400
|
-
return this.getDayPositionYangGui();
|
|
401
|
-
}
|
|
402
|
-
getPositionYangGuiDesc() {
|
|
403
|
-
return this.getDayPositionYangGuiDesc();
|
|
404
|
-
}
|
|
405
|
-
getPositionYinGui() {
|
|
406
|
-
return this.getDayPositionYinGui();
|
|
407
|
-
}
|
|
408
|
-
getPositionYinGuiDesc() {
|
|
409
|
-
return this.getDayPositionYinGuiDesc();
|
|
410
|
-
}
|
|
411
|
-
getPositionFu() {
|
|
412
|
-
return this.getDayPositionFu();
|
|
413
|
-
}
|
|
414
|
-
getPositionFuDesc() {
|
|
415
|
-
return this.getDayPositionFuDesc();
|
|
416
|
-
}
|
|
417
|
-
getPositionCai() {
|
|
418
|
-
return this.getDayPositionCai();
|
|
419
|
-
}
|
|
420
|
-
getPositionCaiDesc() {
|
|
421
|
-
return this.getDayPositionCaiDesc();
|
|
422
|
-
}
|
|
423
|
-
getDayPositionXi() {
|
|
424
|
-
return e.POSITION_XI[this._dayGanIndex + 1];
|
|
425
|
-
}
|
|
426
|
-
getDayPositionXiDesc() {
|
|
427
|
-
const t = e.POSITION_DESC[this.getDayPositionXi()];
|
|
428
|
-
return t || "";
|
|
429
|
-
}
|
|
430
|
-
getDayPositionYangGui() {
|
|
431
|
-
return e.POSITION_YANG_GUI[this._dayGanIndex + 1];
|
|
432
|
-
}
|
|
433
|
-
getDayPositionYangGuiDesc() {
|
|
434
|
-
const t = e.POSITION_DESC[this.getDayPositionYangGui()];
|
|
435
|
-
return t || "";
|
|
436
|
-
}
|
|
437
|
-
getDayPositionYinGui() {
|
|
438
|
-
return e.POSITION_YIN_GUI[this._dayGanIndex + 1];
|
|
439
|
-
}
|
|
440
|
-
getDayPositionYinGuiDesc() {
|
|
441
|
-
const t = e.POSITION_DESC[this.getDayPositionYinGui()];
|
|
442
|
-
return t || "";
|
|
443
|
-
}
|
|
444
|
-
getDayPositionFu(t = 2) {
|
|
445
|
-
return (t === 1 ? e.POSITION_FU : e.POSITION_FU_2)[this._dayGanIndex + 1];
|
|
446
|
-
}
|
|
447
|
-
getDayPositionFuDesc(t = 2) {
|
|
448
|
-
const n = e.POSITION_DESC[this.getDayPositionFu(t)];
|
|
449
|
-
return n || "";
|
|
450
|
-
}
|
|
451
|
-
getDayPositionCai() {
|
|
452
|
-
return e.POSITION_CAI[this._dayGanIndex + 1];
|
|
453
|
-
}
|
|
454
|
-
getDayPositionCaiDesc() {
|
|
455
|
-
const t = e.POSITION_DESC[this.getDayPositionCai()];
|
|
456
|
-
return t || "";
|
|
457
|
-
}
|
|
458
|
-
getTimePositionXi() {
|
|
459
|
-
return e.POSITION_XI[this._timeGanIndex + 1];
|
|
460
|
-
}
|
|
461
|
-
getTimePositionXiDesc() {
|
|
462
|
-
const t = e.POSITION_DESC[this.getTimePositionXi()];
|
|
463
|
-
return t || "";
|
|
464
|
-
}
|
|
465
|
-
getTimePositionYangGui() {
|
|
466
|
-
return e.POSITION_YANG_GUI[this._timeGanIndex + 1];
|
|
467
|
-
}
|
|
468
|
-
getTimePositionYangGuiDesc() {
|
|
469
|
-
const t = e.POSITION_DESC[this.getTimePositionYangGui()];
|
|
470
|
-
return t || "";
|
|
471
|
-
}
|
|
472
|
-
getTimePositionYinGui() {
|
|
473
|
-
return e.POSITION_YIN_GUI[this._timeGanIndex + 1];
|
|
474
|
-
}
|
|
475
|
-
getTimePositionYinGuiDesc() {
|
|
476
|
-
const t = e.POSITION_DESC[this.getTimePositionYinGui()];
|
|
477
|
-
return t || "";
|
|
478
|
-
}
|
|
479
|
-
getTimePositionFu(t = 2) {
|
|
480
|
-
return (t === 1 ? e.POSITION_FU : e.POSITION_FU_2)[this._timeGanIndex + 1];
|
|
481
|
-
}
|
|
482
|
-
getTimePositionFuDesc(t = 2) {
|
|
483
|
-
const n = e.POSITION_DESC[this.getTimePositionFu(t)];
|
|
484
|
-
return n || "";
|
|
485
|
-
}
|
|
486
|
-
getTimePositionCai() {
|
|
487
|
-
return e.POSITION_CAI[this._timeGanIndex + 1];
|
|
488
|
-
}
|
|
489
|
-
getTimePositionCaiDesc() {
|
|
490
|
-
const t = e.POSITION_DESC[this.getTimePositionCai()];
|
|
491
|
-
return t || "";
|
|
492
|
-
}
|
|
493
|
-
getYearPositionTaiSui(t = 2) {
|
|
494
|
-
let n;
|
|
495
|
-
switch (t) {
|
|
496
|
-
case 1:
|
|
497
|
-
n = this._yearZhiIndex;
|
|
498
|
-
break;
|
|
499
|
-
case 3:
|
|
500
|
-
n = this._yearZhiIndexExact;
|
|
501
|
-
break;
|
|
502
|
-
default:
|
|
503
|
-
n = this._yearZhiIndexByLiChun;
|
|
504
|
-
}
|
|
505
|
-
return e.POSITION_TAI_SUI_YEAR[n];
|
|
506
|
-
}
|
|
507
|
-
getYearPositionTaiSuiDesc(t = 2) {
|
|
508
|
-
return e.POSITION_DESC[this.getYearPositionTaiSui(t)];
|
|
509
|
-
}
|
|
510
|
-
getMonthPositionTaiSui(t = 2) {
|
|
511
|
-
let n, i;
|
|
512
|
-
switch (t) {
|
|
513
|
-
case 3:
|
|
514
|
-
n = this._monthZhiIndexExact, i = this._monthGanIndexExact;
|
|
515
|
-
break;
|
|
516
|
-
default:
|
|
517
|
-
n = this._monthZhiIndex, i = this._monthGanIndex;
|
|
518
|
-
}
|
|
519
|
-
let a = n - e.BASE_MONTH_ZHI_INDEX;
|
|
520
|
-
return a < 0 && (a += 12), [
|
|
521
|
-
s.getMessage("bg.gen"),
|
|
522
|
-
e.POSITION_GAN[i],
|
|
523
|
-
s.getMessage("bg.kun"),
|
|
524
|
-
s.getMessage("bg.xun")
|
|
525
|
-
][a % 4];
|
|
526
|
-
}
|
|
527
|
-
getMonthPositionTaiSuiDesc(t = 2) {
|
|
528
|
-
return e.POSITION_DESC[this.getMonthPositionTaiSui(t)];
|
|
529
|
-
}
|
|
530
|
-
getDayPositionTaiSui(t = 2) {
|
|
531
|
-
let n, i;
|
|
532
|
-
switch (t) {
|
|
533
|
-
case 1:
|
|
534
|
-
n = this.getDayInGanZhi(), i = this._yearZhiIndex;
|
|
535
|
-
break;
|
|
536
|
-
case 3:
|
|
537
|
-
n = this.getDayInGanZhi(), i = this._yearZhiIndexExact;
|
|
538
|
-
break;
|
|
539
|
-
default:
|
|
540
|
-
n = this.getDayInGanZhiExact2(), i = this._yearZhiIndexByLiChun;
|
|
541
|
-
}
|
|
542
|
-
let a;
|
|
543
|
-
return [
|
|
544
|
-
s.getMessage("jz.jiaZi"),
|
|
545
|
-
s.getMessage("jz.yiChou"),
|
|
546
|
-
s.getMessage("jz.bingYin"),
|
|
547
|
-
s.getMessage("jz.dingMao"),
|
|
548
|
-
s.getMessage("jz.wuChen"),
|
|
549
|
-
s.getMessage("jz.jiSi")
|
|
550
|
-
].join(",").indexOf(n) > -1 ? a = s.getMessage("bg.zhen") : [
|
|
551
|
-
s.getMessage("jz.bingZi"),
|
|
552
|
-
s.getMessage("jz.dingChou"),
|
|
553
|
-
s.getMessage("jz.wuYin"),
|
|
554
|
-
s.getMessage("jz.jiMao"),
|
|
555
|
-
s.getMessage("jz.gengChen"),
|
|
556
|
-
s.getMessage("jz.xinSi")
|
|
557
|
-
].join(",").indexOf(n) > -1 ? a = s.getMessage("bg.li") : [
|
|
558
|
-
s.getMessage("jz.wuZi"),
|
|
559
|
-
s.getMessage("jz.jiChou"),
|
|
560
|
-
s.getMessage("jz.gengYin"),
|
|
561
|
-
s.getMessage("jz.xinMao"),
|
|
562
|
-
s.getMessage("jz.renChen"),
|
|
563
|
-
s.getMessage("jz.guiSi")
|
|
564
|
-
].join(",").indexOf(n) > -1 ? a = s.getMessage("ps.center") : [
|
|
565
|
-
s.getMessage("jz.gengZi"),
|
|
566
|
-
s.getMessage("jz.xinChou"),
|
|
567
|
-
s.getMessage("jz.renYin"),
|
|
568
|
-
s.getMessage("jz.guiMao"),
|
|
569
|
-
s.getMessage("jz.jiaChen"),
|
|
570
|
-
s.getMessage("jz.yiSi")
|
|
571
|
-
].join(",").indexOf(n) > -1 ? a = s.getMessage("bg.dui") : [
|
|
572
|
-
s.getMessage("jz.renZi"),
|
|
573
|
-
s.getMessage("jz.guiChou"),
|
|
574
|
-
s.getMessage("jz.jiaYin"),
|
|
575
|
-
s.getMessage("jz.yiMao"),
|
|
576
|
-
s.getMessage("jz.bingChen"),
|
|
577
|
-
s.getMessage("jz.dingSi")
|
|
578
|
-
].join(",").indexOf(n) > -1 ? a = s.getMessage("bg.kan") : a = e.POSITION_TAI_SUI_YEAR[i], a;
|
|
579
|
-
}
|
|
580
|
-
getDayPositionTaiSuiDesc(t = 2) {
|
|
581
|
-
return e.POSITION_DESC[this.getDayPositionTaiSui(t)];
|
|
582
|
-
}
|
|
583
|
-
getChong() {
|
|
584
|
-
return this.getDayChong();
|
|
357
|
+
return h.DAY[this._day];
|
|
585
358
|
}
|
|
586
359
|
getChongGan() {
|
|
587
360
|
return this.getDayChongGan();
|
|
@@ -589,227 +362,75 @@ class _ {
|
|
|
589
362
|
getChongGanTie() {
|
|
590
363
|
return this.getDayChongGanTie();
|
|
591
364
|
}
|
|
592
|
-
getChongShengXiao() {
|
|
593
|
-
return this.getDayChongShengXiao();
|
|
594
|
-
}
|
|
595
|
-
getChongDesc() {
|
|
596
|
-
return this.getDayChongDesc();
|
|
597
|
-
}
|
|
598
|
-
getSha() {
|
|
599
|
-
return this.getDaySha();
|
|
600
|
-
}
|
|
601
|
-
getDayChong() {
|
|
602
|
-
return e.CHONG[this._dayZhiIndex];
|
|
603
|
-
}
|
|
604
365
|
getDayChongGan() {
|
|
605
|
-
return
|
|
366
|
+
return h.CHONG_GAN[this._dayGanIndex];
|
|
606
367
|
}
|
|
607
368
|
getDayChongGanTie() {
|
|
608
|
-
return
|
|
609
|
-
}
|
|
610
|
-
getDayChongShengXiao() {
|
|
611
|
-
const t = this.getChong();
|
|
612
|
-
for (let n = 0, i = e.ZHI.length; n < i; n++)
|
|
613
|
-
if (e.ZHI[n] === t)
|
|
614
|
-
return e.SHENGXIAO[n];
|
|
615
|
-
return "";
|
|
616
|
-
}
|
|
617
|
-
getDayChongDesc() {
|
|
618
|
-
return "(" + this.getDayChongGan() + this.getDayChong() + ")" + this.getDayChongShengXiao();
|
|
619
|
-
}
|
|
620
|
-
getDaySha() {
|
|
621
|
-
const t = e.SHA[this.getDayZhi()];
|
|
622
|
-
return t || "";
|
|
623
|
-
}
|
|
624
|
-
getTimeChong() {
|
|
625
|
-
return e.CHONG[this._timeZhiIndex];
|
|
369
|
+
return h.CHONG_GAN_TIE[this._dayGanIndex];
|
|
626
370
|
}
|
|
627
371
|
getTimeChongGan() {
|
|
628
|
-
return
|
|
372
|
+
return h.CHONG_GAN[this._timeGanIndex];
|
|
629
373
|
}
|
|
630
374
|
getTimeChongGanTie() {
|
|
631
|
-
return
|
|
632
|
-
}
|
|
633
|
-
getTimeChongShengXiao() {
|
|
634
|
-
const t = this.getTimeChong();
|
|
635
|
-
for (let n = 0, i = e.ZHI.length; n < i; n++)
|
|
636
|
-
if (e.ZHI[n] === t)
|
|
637
|
-
return e.SHENGXIAO[n];
|
|
638
|
-
return "";
|
|
639
|
-
}
|
|
640
|
-
getTimeChongDesc() {
|
|
641
|
-
return "(" + this.getTimeChongGan() + this.getTimeChong() + ")" + this.getTimeChongShengXiao();
|
|
642
|
-
}
|
|
643
|
-
getTimeSha() {
|
|
644
|
-
const t = e.SHA[this.getTimeZhi()];
|
|
645
|
-
return t || "";
|
|
646
|
-
}
|
|
647
|
-
getYearNaYin() {
|
|
648
|
-
const t = e.NAYIN[this.getYearInGanZhi()];
|
|
649
|
-
return t || "";
|
|
650
|
-
}
|
|
651
|
-
getMonthNaYin() {
|
|
652
|
-
const t = e.NAYIN[this.getMonthInGanZhi()];
|
|
653
|
-
return t || "";
|
|
654
|
-
}
|
|
655
|
-
getDayNaYin() {
|
|
656
|
-
const t = e.NAYIN[this.getDayInGanZhi()];
|
|
657
|
-
return t || "";
|
|
658
|
-
}
|
|
659
|
-
getTimeNaYin() {
|
|
660
|
-
const t = e.NAYIN[this.getTimeInGanZhi()];
|
|
661
|
-
return t || "";
|
|
375
|
+
return h.CHONG_GAN_TIE[this._timeGanIndex];
|
|
662
376
|
}
|
|
663
377
|
getSeason() {
|
|
664
|
-
return
|
|
378
|
+
return h.SEASON[Math.abs(this._month)];
|
|
665
379
|
}
|
|
666
380
|
static _convertJieQi(t) {
|
|
667
|
-
let
|
|
668
|
-
return
|
|
381
|
+
let e = t;
|
|
382
|
+
return e === "DONG_ZHI" ? e = _.getMessage("jq.dongZhi") : e === "DA_HAN" ? e = _.getMessage("jq.daHan") : e === "XIAO_HAN" ? e = _.getMessage("jq.xiaoHan") : e === "LI_CHUN" ? e = _.getMessage("jq.liChun") : e === "DA_XUE" ? e = _.getMessage("jq.daXue") : e === "YU_SHUI" ? e = _.getMessage("jq.yuShui") : e === "JING_ZHE" && (e = _.getMessage("jq.jingZhe")), e;
|
|
669
383
|
}
|
|
670
384
|
getJie() {
|
|
671
|
-
for (let t = 0,
|
|
672
|
-
const
|
|
673
|
-
if (
|
|
674
|
-
return
|
|
385
|
+
for (let t = 0, e = h.JIE_QI_IN_USE.length; t < e; t += 2) {
|
|
386
|
+
const n = h.JIE_QI_IN_USE[t], i = this.getJieQiSolar(n);
|
|
387
|
+
if (i && i.getYear() === this._solar.getYear() && i.getMonth() === this._solar.getMonth() && i.getDay() === this._solar.getDay())
|
|
388
|
+
return I._convertJieQi(n);
|
|
675
389
|
}
|
|
676
390
|
return "";
|
|
677
391
|
}
|
|
678
392
|
getQi() {
|
|
679
|
-
for (let t = 1,
|
|
680
|
-
const
|
|
681
|
-
if (
|
|
682
|
-
return
|
|
393
|
+
for (let t = 1, e = h.JIE_QI_IN_USE.length; t < e; t += 2) {
|
|
394
|
+
const n = h.JIE_QI_IN_USE[t], i = this.getJieQiSolar(n);
|
|
395
|
+
if (i && i.getYear() === this._solar.getYear() && i.getMonth() === this._solar.getMonth() && i.getDay() === this._solar.getDay())
|
|
396
|
+
return I._convertJieQi(n);
|
|
683
397
|
}
|
|
684
398
|
return "";
|
|
685
399
|
}
|
|
686
400
|
getJieQi() {
|
|
687
401
|
let t = "";
|
|
688
|
-
for (const
|
|
689
|
-
const
|
|
690
|
-
if (
|
|
691
|
-
t =
|
|
402
|
+
for (const e in this._jieQi) {
|
|
403
|
+
const n = this._jieQi[e];
|
|
404
|
+
if (n.getYear() == this._solar.getYear() && n.getMonth() == this._solar.getMonth() && n.getDay() == this._solar.getDay()) {
|
|
405
|
+
t = e;
|
|
692
406
|
break;
|
|
693
407
|
}
|
|
694
408
|
}
|
|
695
|
-
return
|
|
409
|
+
return I._convertJieQi(t);
|
|
696
410
|
}
|
|
697
411
|
getWeek() {
|
|
698
412
|
return this._weekIndex;
|
|
699
413
|
}
|
|
700
414
|
getWeekInChinese() {
|
|
701
|
-
return
|
|
702
|
-
}
|
|
703
|
-
getXiu() {
|
|
704
|
-
const t = e.XIU[this.getDayZhi() + this.getWeek()];
|
|
705
|
-
return t || "";
|
|
706
|
-
}
|
|
707
|
-
getXiuLuck() {
|
|
708
|
-
const t = e.XIU_LUCK[this.getXiu()];
|
|
709
|
-
return t || "";
|
|
710
|
-
}
|
|
711
|
-
getXiuSong() {
|
|
712
|
-
const t = e.XIU_SONG[this.getXiu()];
|
|
713
|
-
return t || "";
|
|
714
|
-
}
|
|
715
|
-
getZheng() {
|
|
716
|
-
const t = e.ZHENG[this.getXiu()];
|
|
717
|
-
return t || "";
|
|
718
|
-
}
|
|
719
|
-
getAnimal() {
|
|
720
|
-
const t = e.ANIMAL[this.getXiu()];
|
|
721
|
-
return t || "";
|
|
722
|
-
}
|
|
723
|
-
getGong() {
|
|
724
|
-
const t = e.GONG[this.getXiu()];
|
|
725
|
-
return t || "";
|
|
726
|
-
}
|
|
727
|
-
getShou() {
|
|
728
|
-
const t = e.SHOU[this.getGong()];
|
|
729
|
-
return t || "";
|
|
415
|
+
return Y.WEEK[this.getWeek()];
|
|
730
416
|
}
|
|
731
417
|
getFestivals() {
|
|
732
|
-
const t = [],
|
|
733
|
-
return
|
|
418
|
+
const t = [], e = h.FESTIVAL[this._month + "-" + this._day];
|
|
419
|
+
return e && t.push(e), Math.abs(this._month) == 12 && this._day >= 29 && this._year != this.next(1).getYear() && t.push(_.getMessage("jr.chuXi")), t;
|
|
734
420
|
}
|
|
735
421
|
getOtherFestivals() {
|
|
736
|
-
const t = [],
|
|
737
|
-
|
|
738
|
-
t.push(
|
|
422
|
+
const t = [], e = h.OTHER_FESTIVAL[this._month + "-" + this._day];
|
|
423
|
+
e && e.forEach((s) => {
|
|
424
|
+
t.push(s);
|
|
739
425
|
});
|
|
740
|
-
let
|
|
741
|
-
const
|
|
742
|
-
|
|
743
|
-
let r = 4 -
|
|
744
|
-
return r < 0 && (r += 10),
|
|
745
|
-
}
|
|
746
|
-
getZhiXing() {
|
|
747
|
-
let t = this._dayZhiIndex - this._monthZhiIndex;
|
|
748
|
-
return t < 0 && (t += 12), e.ZHI_XING[t + 1];
|
|
749
|
-
}
|
|
750
|
-
getDayTianShen() {
|
|
751
|
-
const t = this.getMonthZhi(), n = e.ZHI_TIAN_SHEN_OFFSET[t];
|
|
752
|
-
return n == null ? "" : e.TIAN_SHEN[(this._dayZhiIndex + n) % 12 + 1];
|
|
753
|
-
}
|
|
754
|
-
getTimeTianShen() {
|
|
755
|
-
const t = this.getDayZhiExact(), n = e.ZHI_TIAN_SHEN_OFFSET[t];
|
|
756
|
-
return n == null ? "" : e.TIAN_SHEN[(this._timeZhiIndex + n) % 12 + 1];
|
|
757
|
-
}
|
|
758
|
-
getDayTianShenType() {
|
|
759
|
-
const t = e.TIAN_SHEN_TYPE[this.getDayTianShen()];
|
|
760
|
-
return t || "";
|
|
761
|
-
}
|
|
762
|
-
getTimeTianShenType() {
|
|
763
|
-
const t = e.TIAN_SHEN_TYPE[this.getTimeTianShen()];
|
|
764
|
-
return t || "";
|
|
765
|
-
}
|
|
766
|
-
getDayTianShenLuck() {
|
|
767
|
-
const t = e.TIAN_SHEN_TYPE_LUCK[this.getDayTianShenType()];
|
|
768
|
-
return t || "";
|
|
769
|
-
}
|
|
770
|
-
getTimeTianShenLuck() {
|
|
771
|
-
const t = e.TIAN_SHEN_TYPE_LUCK[this.getTimeTianShenType()];
|
|
772
|
-
return t || "";
|
|
773
|
-
}
|
|
774
|
-
getDayPositionTai() {
|
|
775
|
-
return e.POSITION_TAI_DAY[e.getJiaZiIndex(this.getDayInGanZhi())];
|
|
776
|
-
}
|
|
777
|
-
getMonthPositionTai() {
|
|
778
|
-
const t = this._month;
|
|
779
|
-
return t < 0 ? "" : e.POSITION_TAI_MONTH[t - 1];
|
|
780
|
-
}
|
|
781
|
-
getDayYi(t = 1) {
|
|
782
|
-
return e.getDayYi(
|
|
783
|
-
t == 2 ? this.getMonthInGanZhiExact() : this.getMonthInGanZhi(),
|
|
784
|
-
this.getDayInGanZhi()
|
|
785
|
-
);
|
|
786
|
-
}
|
|
787
|
-
getDayJi(t = 1) {
|
|
788
|
-
return e.getDayJi(
|
|
789
|
-
t == 2 ? this.getMonthInGanZhiExact() : this.getMonthInGanZhi(),
|
|
790
|
-
this.getDayInGanZhi()
|
|
791
|
-
);
|
|
792
|
-
}
|
|
793
|
-
getDayJiShen() {
|
|
794
|
-
return e.getDayJiShen(this.getMonth(), this.getDayInGanZhi());
|
|
795
|
-
}
|
|
796
|
-
getDayXiongSha() {
|
|
797
|
-
return e.getDayXiongSha(this.getMonth(), this.getDayInGanZhi());
|
|
798
|
-
}
|
|
799
|
-
getTimeYi() {
|
|
800
|
-
return e.getTimeYi(
|
|
801
|
-
this.getDayInGanZhiExact(),
|
|
802
|
-
this.getTimeInGanZhi()
|
|
803
|
-
);
|
|
804
|
-
}
|
|
805
|
-
getTimeJi() {
|
|
806
|
-
return e.getTimeJi(
|
|
807
|
-
this.getDayInGanZhiExact(),
|
|
808
|
-
this.getTimeInGanZhi()
|
|
809
|
-
);
|
|
426
|
+
let n = this.getJieQiSolar(_.getMessage("jq.qingMing"));
|
|
427
|
+
const i = this._solar.toYmd();
|
|
428
|
+
i === n.next(-1).toYmd() && t.push("寒食节"), n = this.getJieQiSolar(_.getMessage("jq.liChun"));
|
|
429
|
+
let r = 4 - n.getLunar().getDayGanIndex();
|
|
430
|
+
return r < 0 && (r += 10), i === n.next(r + 40).toYmd() && t.push("春社"), n = this.getJieQiSolar(_.getMessage("jq.liQiu")), r = 4 - n.getLunar().getDayGanIndex(), r < 0 && (r += 10), i === n.next(r + 40).toYmd() && t.push("秋社"), t;
|
|
810
431
|
}
|
|
811
432
|
getYueXiang() {
|
|
812
|
-
return
|
|
433
|
+
return h.YUE_XIANG[this._day];
|
|
813
434
|
}
|
|
814
435
|
getJieQiSolar(t) {
|
|
815
436
|
return this._jieQi[t];
|
|
@@ -824,28 +445,28 @@ class _ {
|
|
|
824
445
|
return this._jieQiList;
|
|
825
446
|
}
|
|
826
447
|
getNextJie(t = !1) {
|
|
827
|
-
const
|
|
828
|
-
for (let
|
|
829
|
-
|
|
830
|
-
return this.getNearJieQi(!0,
|
|
448
|
+
const e = [];
|
|
449
|
+
for (let n = 0, i = h.JIE_QI_IN_USE.length / 2; n < i; n++)
|
|
450
|
+
e.push(h.JIE_QI_IN_USE[n * 2]);
|
|
451
|
+
return this.getNearJieQi(!0, e, t);
|
|
831
452
|
}
|
|
832
453
|
getPrevJie(t = !1) {
|
|
833
|
-
const
|
|
834
|
-
for (let
|
|
835
|
-
|
|
836
|
-
return this.getNearJieQi(!1,
|
|
454
|
+
const e = [];
|
|
455
|
+
for (let n = 0, i = h.JIE_QI_IN_USE.length / 2; n < i; n++)
|
|
456
|
+
e.push(h.JIE_QI_IN_USE[n * 2]);
|
|
457
|
+
return this.getNearJieQi(!1, e, t);
|
|
837
458
|
}
|
|
838
459
|
getNextQi(t = !1) {
|
|
839
|
-
const
|
|
840
|
-
for (let
|
|
841
|
-
|
|
842
|
-
return this.getNearJieQi(!0,
|
|
460
|
+
const e = [];
|
|
461
|
+
for (let n = 0, i = h.JIE_QI_IN_USE.length / 2; n < i; n++)
|
|
462
|
+
e.push(h.JIE_QI_IN_USE[n * 2 + 1]);
|
|
463
|
+
return this.getNearJieQi(!0, e, t);
|
|
843
464
|
}
|
|
844
465
|
getPrevQi(t = !1) {
|
|
845
|
-
const
|
|
846
|
-
for (let
|
|
847
|
-
|
|
848
|
-
return this.getNearJieQi(!1,
|
|
466
|
+
const e = [];
|
|
467
|
+
for (let n = 0, i = h.JIE_QI_IN_USE.length / 2; n < i; n++)
|
|
468
|
+
e.push(h.JIE_QI_IN_USE[n * 2 + 1]);
|
|
469
|
+
return this.getNearJieQi(!1, e, t);
|
|
849
470
|
}
|
|
850
471
|
getNextJieQi(t = !1) {
|
|
851
472
|
return this.getNearJieQi(!0, [], t);
|
|
@@ -853,158 +474,89 @@ class _ {
|
|
|
853
474
|
getPrevJieQi(t = !1) {
|
|
854
475
|
return this.getNearJieQi(!1, [], t);
|
|
855
476
|
}
|
|
856
|
-
getNearJieQi(t,
|
|
857
|
-
let
|
|
858
|
-
const
|
|
859
|
-
let
|
|
860
|
-
if (
|
|
861
|
-
for (let
|
|
862
|
-
|
|
863
|
-
const
|
|
864
|
-
for (const
|
|
865
|
-
const o = this._jieQi[
|
|
866
|
-
if (
|
|
477
|
+
getNearJieQi(t, e, n) {
|
|
478
|
+
let i = "", r = null;
|
|
479
|
+
const s = {};
|
|
480
|
+
let g = !1;
|
|
481
|
+
if (e)
|
|
482
|
+
for (let a = 0, o = e.length; a < o; a++)
|
|
483
|
+
s[e[a]] = !0, g = !0;
|
|
484
|
+
const d = n ? this._solar.toYmd() : this._solar.toYmdHms();
|
|
485
|
+
for (const a in this._jieQi) {
|
|
486
|
+
const o = this._jieQi[a], x = I._convertJieQi(a);
|
|
487
|
+
if (g && !s[x])
|
|
867
488
|
continue;
|
|
868
|
-
const
|
|
489
|
+
const c = n ? o.toYmd() : o.toYmdHms();
|
|
869
490
|
if (t) {
|
|
870
|
-
if (
|
|
491
|
+
if (c <= d)
|
|
871
492
|
continue;
|
|
872
493
|
if (r == null)
|
|
873
|
-
|
|
494
|
+
i = x, r = o;
|
|
874
495
|
else {
|
|
875
|
-
const y =
|
|
876
|
-
|
|
496
|
+
const y = n ? r.toYmd() : r.toYmdHms();
|
|
497
|
+
c < y && (i = x, r = o);
|
|
877
498
|
}
|
|
878
499
|
} else {
|
|
879
|
-
if (
|
|
500
|
+
if (c > d)
|
|
880
501
|
continue;
|
|
881
502
|
if (r == null)
|
|
882
|
-
|
|
503
|
+
i = x, r = o;
|
|
883
504
|
else {
|
|
884
|
-
const y =
|
|
885
|
-
|
|
505
|
+
const y = n ? r.toYmd() : r.toYmdHms();
|
|
506
|
+
c > y && (i = x, r = o);
|
|
886
507
|
}
|
|
887
508
|
}
|
|
888
509
|
}
|
|
889
|
-
return new
|
|
510
|
+
return new E(i, r);
|
|
890
511
|
}
|
|
891
512
|
getCurrentJieQi() {
|
|
892
513
|
let t = null;
|
|
893
|
-
for (const
|
|
894
|
-
const
|
|
895
|
-
if (
|
|
896
|
-
t = new
|
|
514
|
+
for (const e in this._jieQi) {
|
|
515
|
+
const n = this._jieQi[e];
|
|
516
|
+
if (n.getYear() == this._solar.getYear() && n.getMonth() == this._solar.getMonth() && n.getDay() == this._solar.getDay()) {
|
|
517
|
+
t = new E(I._convertJieQi(e), n);
|
|
897
518
|
break;
|
|
898
519
|
}
|
|
899
520
|
}
|
|
900
521
|
return t;
|
|
901
522
|
}
|
|
902
523
|
getCurrentJie() {
|
|
903
|
-
for (let t = 0,
|
|
904
|
-
const
|
|
905
|
-
if (
|
|
906
|
-
return new
|
|
524
|
+
for (let t = 0, e = h.JIE_QI_IN_USE.length; t < e; t += 2) {
|
|
525
|
+
const n = h.JIE_QI_IN_USE[t], i = this.getJieQiSolar(n);
|
|
526
|
+
if (i && i.getYear() === this._solar.getYear() && i.getMonth() === this._solar.getMonth() && i.getDay() === this._solar.getDay())
|
|
527
|
+
return new E(I._convertJieQi(n), i);
|
|
907
528
|
}
|
|
908
529
|
return null;
|
|
909
530
|
}
|
|
910
531
|
getCurrentQi() {
|
|
911
|
-
for (let t = 1,
|
|
912
|
-
const
|
|
913
|
-
if (
|
|
914
|
-
return new
|
|
532
|
+
for (let t = 1, e = h.JIE_QI_IN_USE.length; t < e; t += 2) {
|
|
533
|
+
const n = h.JIE_QI_IN_USE[t], i = this.getJieQiSolar(n);
|
|
534
|
+
if (i && i.getYear() === this._solar.getYear() && i.getMonth() === this._solar.getMonth() && i.getDay() === this._solar.getDay())
|
|
535
|
+
return new E(I._convertJieQi(n), i);
|
|
915
536
|
}
|
|
916
537
|
return null;
|
|
917
538
|
}
|
|
918
539
|
next(t) {
|
|
919
540
|
return this._solar.next(t).getLunar();
|
|
920
541
|
}
|
|
921
|
-
getYearXun() {
|
|
922
|
-
return e.getXun(this.getYearInGanZhi());
|
|
923
|
-
}
|
|
924
|
-
getMonthXun() {
|
|
925
|
-
return e.getXun(this.getMonthInGanZhi());
|
|
926
|
-
}
|
|
927
|
-
getDayXun() {
|
|
928
|
-
return e.getXun(this.getDayInGanZhi());
|
|
929
|
-
}
|
|
930
|
-
getTimeXun() {
|
|
931
|
-
return e.getXun(this.getTimeInGanZhi());
|
|
932
|
-
}
|
|
933
|
-
getYearXunByLiChun() {
|
|
934
|
-
return e.getXun(this.getYearInGanZhiByLiChun());
|
|
935
|
-
}
|
|
936
|
-
getYearXunExact() {
|
|
937
|
-
return e.getXun(this.getYearInGanZhiExact());
|
|
938
|
-
}
|
|
939
|
-
getMonthXunExact() {
|
|
940
|
-
return e.getXun(this.getMonthInGanZhiExact());
|
|
941
|
-
}
|
|
942
|
-
getDayXunExact() {
|
|
943
|
-
return e.getXun(this.getDayInGanZhiExact());
|
|
944
|
-
}
|
|
945
|
-
getDayXunExact2() {
|
|
946
|
-
return e.getXun(this.getDayInGanZhiExact2());
|
|
947
|
-
}
|
|
948
|
-
getYearXunKong() {
|
|
949
|
-
return e.getXunKong(this.getYearInGanZhi());
|
|
950
|
-
}
|
|
951
|
-
getMonthXunKong() {
|
|
952
|
-
return e.getXunKong(this.getMonthInGanZhi());
|
|
953
|
-
}
|
|
954
|
-
getDayXunKong() {
|
|
955
|
-
return e.getXunKong(this.getDayInGanZhi());
|
|
956
|
-
}
|
|
957
|
-
getTimeXunKong() {
|
|
958
|
-
return e.getXunKong(this.getTimeInGanZhi());
|
|
959
|
-
}
|
|
960
|
-
getYearXunKongByLiChun() {
|
|
961
|
-
return e.getXunKong(this.getYearInGanZhiByLiChun());
|
|
962
|
-
}
|
|
963
|
-
getYearXunKongExact() {
|
|
964
|
-
return e.getXunKong(this.getYearInGanZhiExact());
|
|
965
|
-
}
|
|
966
|
-
getMonthXunKongExact() {
|
|
967
|
-
return e.getXunKong(this.getMonthInGanZhiExact());
|
|
968
|
-
}
|
|
969
|
-
getDayXunKongExact() {
|
|
970
|
-
return e.getXunKong(this.getDayInGanZhiExact());
|
|
971
|
-
}
|
|
972
|
-
getDayXunKongExact2() {
|
|
973
|
-
return e.getXunKong(this.getDayInGanZhiExact2());
|
|
974
|
-
}
|
|
975
542
|
toString() {
|
|
976
543
|
return this.getYearInChinese() + "年" + this.getMonthInChinese() + "月" + this.getDayInChinese();
|
|
977
544
|
}
|
|
978
545
|
toFullString() {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
return e.
|
|
990
|
-
}
|
|
991
|
-
getWuHou() {
|
|
992
|
-
const t = this.getPrevJieQi(!0), n = e.find(t.getName(), e.JIE_QI);
|
|
993
|
-
let i = Math.floor(this._solar.subtract(t.getSolar()) / 5);
|
|
994
|
-
return i > 2 && (i = 2), e.WU_HOU[(n.index * 3 + i) % e.WU_HOU.length];
|
|
995
|
-
}
|
|
996
|
-
getHou() {
|
|
997
|
-
const t = this.getPrevJieQi(!0), n = this._solar.subtract(t.getSolar()), i = e.HOU.length - 1;
|
|
998
|
-
let a = Math.floor(n / 5);
|
|
999
|
-
return a > i && (a = i), t.getName() + " " + e.HOU[a];
|
|
1000
|
-
}
|
|
1001
|
-
getDayLu() {
|
|
1002
|
-
const t = e.LU[this.getDayGan()], n = e.LU[this.getDayZhi()];
|
|
1003
|
-
let i = t + "命互禄";
|
|
1004
|
-
return n && (i += " " + n + "命进禄"), i;
|
|
546
|
+
const t = [
|
|
547
|
+
this.toString(),
|
|
548
|
+
`${this.getYearInGanZhi()}(${this.getYearShengXiao()})年`,
|
|
549
|
+
`${this.getMonthInGanZhi()}(${this.getMonthShengXiao()})月`,
|
|
550
|
+
`${this.getDayInGanZhi()}(${this.getDayShengXiao()})日`,
|
|
551
|
+
`${this.getTimeZhi()}(${this.getTimeShengXiao()})时`,
|
|
552
|
+
"星期" + this.getWeekInChinese(),
|
|
553
|
+
...this.getFestivals().map((n) => `(${n})`),
|
|
554
|
+
...this.getOtherFestivals().map((n) => `(${n})`)
|
|
555
|
+
], e = this.getJieQi();
|
|
556
|
+
return e.length > 0 && t.push(`[${e}]`), t.join(" ");
|
|
1005
557
|
}
|
|
1006
558
|
getTime() {
|
|
1007
|
-
return
|
|
559
|
+
return l.fromYmdHms(
|
|
1008
560
|
this._year,
|
|
1009
561
|
this._month,
|
|
1010
562
|
this._day,
|
|
@@ -1015,14 +567,14 @@ class _ {
|
|
|
1015
567
|
}
|
|
1016
568
|
getTimes() {
|
|
1017
569
|
const t = [];
|
|
1018
|
-
t.push(
|
|
1019
|
-
for (let
|
|
570
|
+
t.push(l.fromYmdHms(this._year, this._month, this._day, 0, 0, 0));
|
|
571
|
+
for (let e = 0; e < 12; e++)
|
|
1020
572
|
t.push(
|
|
1021
|
-
|
|
573
|
+
l.fromYmdHms(
|
|
1022
574
|
this._year,
|
|
1023
575
|
this._month,
|
|
1024
576
|
this._day,
|
|
1025
|
-
(
|
|
577
|
+
(e + 1) * 2 - 1,
|
|
1026
578
|
0,
|
|
1027
579
|
0
|
|
1028
580
|
)
|
|
@@ -1031,5 +583,5 @@ class _ {
|
|
|
1031
583
|
}
|
|
1032
584
|
}
|
|
1033
585
|
export {
|
|
1034
|
-
|
|
586
|
+
I as Lunar
|
|
1035
587
|
};
|