@unicom-cloud/utils 0.1.11 → 0.1.13
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/date/index.js +22 -0
- package/date.js +9 -0
- package/filesize/src/constants.js +22 -22
- package/filesize/src/filesize.js +32 -33
- package/index.js +56 -54
- 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/package.json +1 -1
- package/snapdom/src/api/preCache.js +27 -37
- package/snapdom/src/api/snapdom.js +75 -58
- package/snapdom/src/core/cache.js +19 -8
- package/snapdom/src/core/capture.js +49 -48
- package/snapdom/src/core/clone.js +96 -31
- package/snapdom/src/core/prepare.js +43 -37
- package/snapdom/src/modules/background.js +29 -20
- package/snapdom/src/modules/fonts.js +94 -104
- package/snapdom/src/modules/iconFonts.js +28 -0
- package/snapdom/src/modules/images.js +6 -6
- package/snapdom/src/modules/pseudo.js +52 -50
- package/snapdom/src/modules/styles.js +26 -6
- package/snapdom/src/modules/svgDefs.js +26 -0
- package/snapdom/src/utils/cssTools.js +41 -41
- package/snapdom/src/utils/helpers.js +128 -84
- 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/search/index.js +90 -0
- package/tree.js +9 -7
- package/types/date/index.d.ts +4 -0
- package/types/filesize/src/constants.d.ts +12 -12
- package/types/filesize/src/filesize.d.ts +63 -22
- package/types/index.d.ts +4 -3
- 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/snapdom/src/core/cache.d.ts +17 -11
- package/types/snapdom/src/core/capture.d.ts +4 -0
- package/types/snapdom/src/core/clone.d.ts +4 -5
- package/types/snapdom/src/core/prepare.d.ts +8 -1
- package/types/snapdom/src/modules/background.d.ts +1 -2
- package/types/snapdom/src/modules/fonts.d.ts +1 -3
- package/types/snapdom/src/modules/iconFonts.d.ts +2 -0
- package/types/snapdom/src/modules/pseudo.d.ts +1 -3
- package/types/snapdom/src/modules/styles.d.ts +1 -10
- package/types/snapdom/src/modules/svgDefs.d.ts +19 -0
- package/types/snapdom/src/utils/cssTools.d.ts +1 -2
- package/types/snapdom/src/utils/helpers.d.ts +1 -1
- 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 +1 -0
- package/types/tree/search/index.d.ts +80 -0
- package/types/ui-color/compareColorByRange.d.ts +2 -0
- package/types/ui-color/index.d.ts +208 -0
- package/ui-color/compareColorByRange.js +9 -0
- package/ui-color/index.js +162 -0
- package/uiColor.js +29 -0
- package/convertTime.js +0 -4
- package/dayjs/index.js +0 -15
- package/dayjs.js +0 -5
- package/lunar-converter/index.js +0 -641
- package/lunarConverter.js +0 -4
- package/search-tree/index.js +0 -54
- package/searchTree.js +0 -4
- package/types/dayjs/index.d.ts +0 -1
- package/types/lunar-converter/index.d.ts +0 -113
- package/types/search-tree/index.d.ts +0 -20
- /package/{convert-time/index.js → date/convertTime.js} +0 -0
- /package/types/{convert-time/index.d.ts → date/convertTime.d.ts} +0 -0
|
@@ -0,0 +1,1035 @@
|
|
|
1
|
+
import { I18n as s } from "./I18n.js";
|
|
2
|
+
import { JieQi as G } from "./JieQi.js";
|
|
3
|
+
import { LunarTime as E } from "./LunarTime.js";
|
|
4
|
+
import { LunarUtil as e } from "./LunarUtil.js";
|
|
5
|
+
import { LunarYear as Z } from "./LunarYear.js";
|
|
6
|
+
import { Solar as c } from "./Solar.js";
|
|
7
|
+
import { SolarUtil as S } from "./SolarUtil.js";
|
|
8
|
+
class _ {
|
|
9
|
+
_year;
|
|
10
|
+
_month;
|
|
11
|
+
_day;
|
|
12
|
+
_hour;
|
|
13
|
+
_minute;
|
|
14
|
+
_second;
|
|
15
|
+
_timeGanIndex;
|
|
16
|
+
_timeZhiIndex;
|
|
17
|
+
_dayGanIndex;
|
|
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)
|
|
46
|
+
throw new Error("lunar day must bigger than 0");
|
|
47
|
+
const h = u.getDayCount();
|
|
48
|
+
if (i > h)
|
|
49
|
+
throw new Error(
|
|
50
|
+
`only ${h} days in lunar year ${t} month ${n}`
|
|
51
|
+
);
|
|
52
|
+
const o = c.fromJulianDay(u.getFirstJulianDay() + i - 1), d = c.fromYmdHms(
|
|
53
|
+
o.getYear(),
|
|
54
|
+
o.getMonth(),
|
|
55
|
+
o.getDay(),
|
|
56
|
+
a,
|
|
57
|
+
r,
|
|
58
|
+
g
|
|
59
|
+
);
|
|
60
|
+
return o.getYear() !== t && (I = Z.fromYear(o.getYear())), new _(
|
|
61
|
+
t,
|
|
62
|
+
n,
|
|
63
|
+
i,
|
|
64
|
+
a,
|
|
65
|
+
r,
|
|
66
|
+
g,
|
|
67
|
+
d,
|
|
68
|
+
I
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static fromSolar(t) {
|
|
72
|
+
let n = 0, i = 0, a = 0;
|
|
73
|
+
const r = Z.fromYear(t.getYear()), g = r.getMonths();
|
|
74
|
+
for (let I = 0, u = g.length; I < u; I++) {
|
|
75
|
+
const h = g[I], o = t.subtract(c.fromJulianDay(h.getFirstJulianDay()));
|
|
76
|
+
if (o < h.getDayCount()) {
|
|
77
|
+
n = h.getYear(), i = h.getMonth(), a = o + 1;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return new _(
|
|
82
|
+
n,
|
|
83
|
+
i,
|
|
84
|
+
a,
|
|
85
|
+
t.getHour(),
|
|
86
|
+
t.getMinute(),
|
|
87
|
+
t.getSecond(),
|
|
88
|
+
t,
|
|
89
|
+
r
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
static fromDate(t) {
|
|
93
|
+
return _.fromSolar(c.fromDate(t));
|
|
94
|
+
}
|
|
95
|
+
static _computeJieQi(t, n) {
|
|
96
|
+
const i = n.getJieQiJulianDays();
|
|
97
|
+
for (let a = 0, r = e.JIE_QI_IN_USE.length; a < r; a++) {
|
|
98
|
+
const g = e.JIE_QI_IN_USE[a];
|
|
99
|
+
t.jieQiList.push(g), t.jieQi[g] = c.fromJulianDay(i[a]);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
static _computeYear(t, n, i) {
|
|
103
|
+
const a = i - 4;
|
|
104
|
+
let r = a % 10, g = a % 12;
|
|
105
|
+
r < 0 && (r += 10), g < 0 && (g += 12);
|
|
106
|
+
let I = r, u = g, h = r, o = g;
|
|
107
|
+
const d = n.getYear(), x = n.toYmd(), y = n.toYmdHms();
|
|
108
|
+
let m = t.jieQi[s.getMessage("jq.liChun")];
|
|
109
|
+
m.getYear() != d && (m = t.jieQi.LI_CHUN);
|
|
110
|
+
const D = m.toYmd(), l = m.toYmdHms();
|
|
111
|
+
i === d ? (x < D && (I--, u--), y < l && (h--, o--)) : i < d && (x >= D && (I++, u++), y >= l && (h++, o++)), t.yearGanIndex = r, t.yearZhiIndex = g, t.yearGanIndexByLiChun = (I < 0 ? I + 10 : I) % 10, t.yearZhiIndexByLiChun = (u < 0 ? u + 12 : u) % 12, t.yearGanIndexExact = (h < 0 ? h + 10 : h) % 10, t.yearZhiIndexExact = (o < 0 ? o + 12 : o) % 12;
|
|
112
|
+
}
|
|
113
|
+
static _computeMonth(t, n) {
|
|
114
|
+
let i = null, a, r;
|
|
115
|
+
const g = n.toYmd(), I = n.toYmdHms(), u = e.JIE_QI_IN_USE.length;
|
|
116
|
+
let h = -3;
|
|
117
|
+
for (a = 0; a < u; a += 2) {
|
|
118
|
+
r = t.jieQi[e.JIE_QI_IN_USE[a]];
|
|
119
|
+
const d = i == null ? g : i.toYmd();
|
|
120
|
+
if (g >= d && g < r.toYmd())
|
|
121
|
+
break;
|
|
122
|
+
i = r, h++;
|
|
123
|
+
}
|
|
124
|
+
let o = ((t.yearGanIndexByLiChun + (h < 0 ? 1 : 0)) % 5 + 1) * 2 % 10;
|
|
125
|
+
for (t.monthGanIndex = ((h < 0 ? h + 10 : h) + o) % 10, t.monthZhiIndex = ((h < 0 ? h + 12 : h) + e.BASE_MONTH_ZHI_INDEX) % 12, i = null, h = -3, a = 0; a < u; a += 2) {
|
|
126
|
+
r = t.jieQi[e.JIE_QI_IN_USE[a]];
|
|
127
|
+
const d = i == null ? I : i.toYmdHms();
|
|
128
|
+
if (I >= d && I < r.toYmdHms())
|
|
129
|
+
break;
|
|
130
|
+
i = r, h++;
|
|
131
|
+
}
|
|
132
|
+
o = ((t.yearGanIndexExact + (h < 0 ? 1 : 0)) % 5 + 1) * 2 % 10, t.monthGanIndexExact = ((h < 0 ? h + 10 : h) + o) % 10, t.monthZhiIndexExact = ((h < 0 ? h + 12 : h) + e.BASE_MONTH_ZHI_INDEX) % 12;
|
|
133
|
+
}
|
|
134
|
+
static _computeDay(t, n, i, a) {
|
|
135
|
+
const r = c.fromYmdHms(
|
|
136
|
+
n.getYear(),
|
|
137
|
+
n.getMonth(),
|
|
138
|
+
n.getDay(),
|
|
139
|
+
12,
|
|
140
|
+
0,
|
|
141
|
+
0
|
|
142
|
+
), g = Math.floor(r.getJulianDay()) - 11, I = g % 10, u = g % 12;
|
|
143
|
+
t.dayGanIndex = I, t.dayZhiIndex = u;
|
|
144
|
+
let h = I, o = u;
|
|
145
|
+
t.dayGanIndexExact2 = h, t.dayZhiIndexExact2 = o;
|
|
146
|
+
const d = (i < 10 ? "0" : "") + i + ":" + (a < 10 ? "0" : "") + a;
|
|
147
|
+
d >= "23:00" && d <= "23:59" && (h++, h >= 10 && (h -= 10), o++, o >= 12 && (o -= 12)), t.dayGanIndexExact = h, t.dayZhiIndexExact = o;
|
|
148
|
+
}
|
|
149
|
+
static _computeTime(t, n, i) {
|
|
150
|
+
const a = e.getTimeZhiIndex(
|
|
151
|
+
(n < 10 ? "0" : "") + n + ":" + (i < 10 ? "0" : "") + i
|
|
152
|
+
);
|
|
153
|
+
t.timeZhiIndex = a, t.timeGanIndex = (t.dayGanIndexExact % 5 * 2 + a) % 10;
|
|
154
|
+
}
|
|
155
|
+
static _computeWeek(t, n) {
|
|
156
|
+
t.weekIndex = n.getWeek();
|
|
157
|
+
}
|
|
158
|
+
static _compute(t, n, i, a, r) {
|
|
159
|
+
const g = {
|
|
160
|
+
timeGanIndex: 0,
|
|
161
|
+
timeZhiIndex: 0,
|
|
162
|
+
dayGanIndex: 0,
|
|
163
|
+
dayZhiIndex: 0,
|
|
164
|
+
dayGanIndexExact: 0,
|
|
165
|
+
dayZhiIndexExact: 0,
|
|
166
|
+
dayGanIndexExact2: 0,
|
|
167
|
+
dayZhiIndexExact2: 0,
|
|
168
|
+
monthGanIndex: 0,
|
|
169
|
+
monthZhiIndex: 0,
|
|
170
|
+
monthGanIndexExact: 0,
|
|
171
|
+
monthZhiIndexExact: 0,
|
|
172
|
+
yearGanIndex: 0,
|
|
173
|
+
yearZhiIndex: 0,
|
|
174
|
+
yearGanIndexByLiChun: 0,
|
|
175
|
+
yearZhiIndexByLiChun: 0,
|
|
176
|
+
yearGanIndexExact: 0,
|
|
177
|
+
yearZhiIndexExact: 0,
|
|
178
|
+
weekIndex: 0,
|
|
179
|
+
jieQi: {},
|
|
180
|
+
jieQiList: []
|
|
181
|
+
};
|
|
182
|
+
return _._computeJieQi(g, r), _._computeYear(g, a, t), _._computeMonth(g, a), _._computeDay(g, a, n, i), _._computeTime(g, n, i), _._computeWeek(g, a), g;
|
|
183
|
+
}
|
|
184
|
+
constructor(t, n, i, a, r, g, I, u) {
|
|
185
|
+
const h = _._compute(t, a, r, I, u);
|
|
186
|
+
this._year = t, this._month = n, this._day = i, this._hour = a, this._minute = r, this._second = g, this._timeGanIndex = h.timeGanIndex, this._timeZhiIndex = h.timeZhiIndex, this._dayGanIndex = h.dayGanIndex, this._dayZhiIndex = h.dayZhiIndex, this._dayGanIndexExact = h.dayGanIndexExact, this._dayZhiIndexExact = h.dayZhiIndexExact, this._dayGanIndexExact2 = h.dayGanIndexExact2, this._dayZhiIndexExact2 = h.dayZhiIndexExact2, this._monthGanIndex = h.monthGanIndex, this._monthZhiIndex = h.monthZhiIndex, this._monthGanIndexExact = h.monthGanIndexExact, this._monthZhiIndexExact = h.monthZhiIndexExact, this._yearGanIndex = h.yearGanIndex, this._yearZhiIndex = h.yearZhiIndex, this._yearGanIndexByLiChun = h.yearGanIndexByLiChun, this._yearZhiIndexByLiChun = h.yearZhiIndexByLiChun, this._yearGanIndexExact = h.yearGanIndexExact, this._yearZhiIndexExact = h.yearZhiIndexExact, this._weekIndex = h.weekIndex, this._jieQi = h.jieQi, this._jieQiList = h.jieQiList, this._solar = I;
|
|
187
|
+
}
|
|
188
|
+
getYear() {
|
|
189
|
+
return this._year;
|
|
190
|
+
}
|
|
191
|
+
getMonth() {
|
|
192
|
+
return this._month;
|
|
193
|
+
}
|
|
194
|
+
getDay() {
|
|
195
|
+
return this._day;
|
|
196
|
+
}
|
|
197
|
+
getHour() {
|
|
198
|
+
return this._hour;
|
|
199
|
+
}
|
|
200
|
+
getMinute() {
|
|
201
|
+
return this._minute;
|
|
202
|
+
}
|
|
203
|
+
getSecond() {
|
|
204
|
+
return this._second;
|
|
205
|
+
}
|
|
206
|
+
getTimeGanIndex() {
|
|
207
|
+
return this._timeGanIndex;
|
|
208
|
+
}
|
|
209
|
+
getTimeZhiIndex() {
|
|
210
|
+
return this._timeZhiIndex;
|
|
211
|
+
}
|
|
212
|
+
getDayGanIndex() {
|
|
213
|
+
return this._dayGanIndex;
|
|
214
|
+
}
|
|
215
|
+
getDayZhiIndex() {
|
|
216
|
+
return this._dayZhiIndex;
|
|
217
|
+
}
|
|
218
|
+
getMonthGanIndex() {
|
|
219
|
+
return this._monthGanIndex;
|
|
220
|
+
}
|
|
221
|
+
getMonthZhiIndex() {
|
|
222
|
+
return this._monthZhiIndex;
|
|
223
|
+
}
|
|
224
|
+
getYearGanIndex() {
|
|
225
|
+
return this._yearGanIndex;
|
|
226
|
+
}
|
|
227
|
+
getYearZhiIndex() {
|
|
228
|
+
return this._yearZhiIndex;
|
|
229
|
+
}
|
|
230
|
+
getYearGanIndexByLiChun() {
|
|
231
|
+
return this._yearGanIndexByLiChun;
|
|
232
|
+
}
|
|
233
|
+
getYearZhiIndexByLiChun() {
|
|
234
|
+
return this._yearZhiIndexByLiChun;
|
|
235
|
+
}
|
|
236
|
+
getDayGanIndexExact() {
|
|
237
|
+
return this._dayGanIndexExact;
|
|
238
|
+
}
|
|
239
|
+
getDayZhiIndexExact() {
|
|
240
|
+
return this._dayZhiIndexExact;
|
|
241
|
+
}
|
|
242
|
+
getDayGanIndexExact2() {
|
|
243
|
+
return this._dayGanIndexExact2;
|
|
244
|
+
}
|
|
245
|
+
getDayZhiIndexExact2() {
|
|
246
|
+
return this._dayZhiIndexExact2;
|
|
247
|
+
}
|
|
248
|
+
getMonthGanIndexExact() {
|
|
249
|
+
return this._monthGanIndexExact;
|
|
250
|
+
}
|
|
251
|
+
getMonthZhiIndexExact() {
|
|
252
|
+
return this._monthZhiIndexExact;
|
|
253
|
+
}
|
|
254
|
+
getYearGanIndexExact() {
|
|
255
|
+
return this._yearGanIndexExact;
|
|
256
|
+
}
|
|
257
|
+
getYearZhiIndexExact() {
|
|
258
|
+
return this._yearZhiIndexExact;
|
|
259
|
+
}
|
|
260
|
+
getGan() {
|
|
261
|
+
return this.getYearGan();
|
|
262
|
+
}
|
|
263
|
+
getZhi() {
|
|
264
|
+
return this.getYearZhi();
|
|
265
|
+
}
|
|
266
|
+
getYearGan() {
|
|
267
|
+
return e.GAN[this._yearGanIndex + 1];
|
|
268
|
+
}
|
|
269
|
+
getYearGanByLiChun() {
|
|
270
|
+
return e.GAN[this._yearGanIndexByLiChun + 1];
|
|
271
|
+
}
|
|
272
|
+
getYearGanExact() {
|
|
273
|
+
return e.GAN[this._yearGanIndexExact + 1];
|
|
274
|
+
}
|
|
275
|
+
getYearZhi() {
|
|
276
|
+
return e.ZHI[this._yearZhiIndex + 1];
|
|
277
|
+
}
|
|
278
|
+
getYearZhiByLiChun() {
|
|
279
|
+
return e.ZHI[this._yearZhiIndexByLiChun + 1];
|
|
280
|
+
}
|
|
281
|
+
getYearZhiExact() {
|
|
282
|
+
return e.ZHI[this._yearZhiIndexExact + 1];
|
|
283
|
+
}
|
|
284
|
+
getYearInGanZhi() {
|
|
285
|
+
return this.getYearGan() + this.getYearZhi();
|
|
286
|
+
}
|
|
287
|
+
getYearInGanZhiByLiChun() {
|
|
288
|
+
return this.getYearGanByLiChun() + this.getYearZhiByLiChun();
|
|
289
|
+
}
|
|
290
|
+
getYearInGanZhiExact() {
|
|
291
|
+
return this.getYearGanExact() + this.getYearZhiExact();
|
|
292
|
+
}
|
|
293
|
+
getMonthGan() {
|
|
294
|
+
return e.GAN[this._monthGanIndex + 1];
|
|
295
|
+
}
|
|
296
|
+
getMonthGanExact() {
|
|
297
|
+
return e.GAN[this._monthGanIndexExact + 1];
|
|
298
|
+
}
|
|
299
|
+
getMonthZhi() {
|
|
300
|
+
return e.ZHI[this._monthZhiIndex + 1];
|
|
301
|
+
}
|
|
302
|
+
getMonthZhiExact() {
|
|
303
|
+
return e.ZHI[this._monthZhiIndexExact + 1];
|
|
304
|
+
}
|
|
305
|
+
getMonthInGanZhi() {
|
|
306
|
+
return this.getMonthGan() + this.getMonthZhi();
|
|
307
|
+
}
|
|
308
|
+
getMonthInGanZhiExact() {
|
|
309
|
+
return this.getMonthGanExact() + this.getMonthZhiExact();
|
|
310
|
+
}
|
|
311
|
+
getDayGan() {
|
|
312
|
+
return e.GAN[this._dayGanIndex + 1];
|
|
313
|
+
}
|
|
314
|
+
getDayGanExact() {
|
|
315
|
+
return e.GAN[this._dayGanIndexExact + 1];
|
|
316
|
+
}
|
|
317
|
+
getDayGanExact2() {
|
|
318
|
+
return e.GAN[this._dayGanIndexExact2 + 1];
|
|
319
|
+
}
|
|
320
|
+
getDayZhi() {
|
|
321
|
+
return e.ZHI[this._dayZhiIndex + 1];
|
|
322
|
+
}
|
|
323
|
+
getDayZhiExact() {
|
|
324
|
+
return e.ZHI[this._dayZhiIndexExact + 1];
|
|
325
|
+
}
|
|
326
|
+
getDayZhiExact2() {
|
|
327
|
+
return e.ZHI[this._dayZhiIndexExact2 + 1];
|
|
328
|
+
}
|
|
329
|
+
getDayInGanZhi() {
|
|
330
|
+
return this.getDayGan() + this.getDayZhi();
|
|
331
|
+
}
|
|
332
|
+
getDayInGanZhiExact() {
|
|
333
|
+
return this.getDayGanExact() + this.getDayZhiExact();
|
|
334
|
+
}
|
|
335
|
+
getDayInGanZhiExact2() {
|
|
336
|
+
return this.getDayGanExact2() + this.getDayZhiExact2();
|
|
337
|
+
}
|
|
338
|
+
getTimeGan() {
|
|
339
|
+
return e.GAN[this._timeGanIndex + 1];
|
|
340
|
+
}
|
|
341
|
+
getTimeZhi() {
|
|
342
|
+
return e.ZHI[this._timeZhiIndex + 1];
|
|
343
|
+
}
|
|
344
|
+
getTimeInGanZhi() {
|
|
345
|
+
return this.getTimeGan() + this.getTimeZhi();
|
|
346
|
+
}
|
|
347
|
+
getShengxiao() {
|
|
348
|
+
return this.getYearShengXiao();
|
|
349
|
+
}
|
|
350
|
+
getYearShengXiao() {
|
|
351
|
+
return e.SHENGXIAO[this._yearZhiIndex + 1];
|
|
352
|
+
}
|
|
353
|
+
getYearShengXiaoByLiChun() {
|
|
354
|
+
return e.SHENGXIAO[this._yearZhiIndexByLiChun + 1];
|
|
355
|
+
}
|
|
356
|
+
getYearShengXiaoExact() {
|
|
357
|
+
return e.SHENGXIAO[this._yearZhiIndexExact + 1];
|
|
358
|
+
}
|
|
359
|
+
getMonthShengXiao() {
|
|
360
|
+
return e.SHENGXIAO[this._monthZhiIndex + 1];
|
|
361
|
+
}
|
|
362
|
+
getMonthShengXiaoExact() {
|
|
363
|
+
return e.SHENGXIAO[this._monthZhiIndexExact + 1];
|
|
364
|
+
}
|
|
365
|
+
getDayShengXiao() {
|
|
366
|
+
return e.SHENGXIAO[this._dayZhiIndex + 1];
|
|
367
|
+
}
|
|
368
|
+
getTimeShengXiao() {
|
|
369
|
+
return e.SHENGXIAO[this._timeZhiIndex + 1];
|
|
370
|
+
}
|
|
371
|
+
getYearInChinese() {
|
|
372
|
+
const t = this._year + "";
|
|
373
|
+
let n = "";
|
|
374
|
+
const i = 48;
|
|
375
|
+
for (let a = 0, r = t.length; a < r; a++) {
|
|
376
|
+
const g = t.charCodeAt(a);
|
|
377
|
+
n += e.NUMBER[g - i];
|
|
378
|
+
}
|
|
379
|
+
return n;
|
|
380
|
+
}
|
|
381
|
+
getMonthInChinese() {
|
|
382
|
+
return (this._month < 0 ? "闰" : "") + e.MONTH[Math.abs(this._month)];
|
|
383
|
+
}
|
|
384
|
+
getDayInChinese() {
|
|
385
|
+
return e.DAY[this._day];
|
|
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();
|
|
585
|
+
}
|
|
586
|
+
getChongGan() {
|
|
587
|
+
return this.getDayChongGan();
|
|
588
|
+
}
|
|
589
|
+
getChongGanTie() {
|
|
590
|
+
return this.getDayChongGanTie();
|
|
591
|
+
}
|
|
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
|
+
getDayChongGan() {
|
|
605
|
+
return e.CHONG_GAN[this._dayGanIndex];
|
|
606
|
+
}
|
|
607
|
+
getDayChongGanTie() {
|
|
608
|
+
return e.CHONG_GAN_TIE[this._dayGanIndex];
|
|
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];
|
|
626
|
+
}
|
|
627
|
+
getTimeChongGan() {
|
|
628
|
+
return e.CHONG_GAN[this._timeGanIndex];
|
|
629
|
+
}
|
|
630
|
+
getTimeChongGanTie() {
|
|
631
|
+
return e.CHONG_GAN_TIE[this._timeGanIndex];
|
|
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 || "";
|
|
662
|
+
}
|
|
663
|
+
getSeason() {
|
|
664
|
+
return e.SEASON[Math.abs(this._month)];
|
|
665
|
+
}
|
|
666
|
+
static _convertJieQi(t) {
|
|
667
|
+
let n = t;
|
|
668
|
+
return n === "DONG_ZHI" ? n = s.getMessage("jq.dongZhi") : n === "DA_HAN" ? n = s.getMessage("jq.daHan") : n === "XIAO_HAN" ? n = s.getMessage("jq.xiaoHan") : n === "LI_CHUN" ? n = s.getMessage("jq.liChun") : n === "DA_XUE" ? n = s.getMessage("jq.daXue") : n === "YU_SHUI" ? n = s.getMessage("jq.yuShui") : n === "JING_ZHE" && (n = s.getMessage("jq.jingZhe")), n;
|
|
669
|
+
}
|
|
670
|
+
getJie() {
|
|
671
|
+
for (let t = 0, n = e.JIE_QI_IN_USE.length; t < n; t += 2) {
|
|
672
|
+
const i = e.JIE_QI_IN_USE[t], a = this.getJieQiSolar(i);
|
|
673
|
+
if (a && a.getYear() === this._solar.getYear() && a.getMonth() === this._solar.getMonth() && a.getDay() === this._solar.getDay())
|
|
674
|
+
return _._convertJieQi(i);
|
|
675
|
+
}
|
|
676
|
+
return "";
|
|
677
|
+
}
|
|
678
|
+
getQi() {
|
|
679
|
+
for (let t = 1, n = e.JIE_QI_IN_USE.length; t < n; t += 2) {
|
|
680
|
+
const i = e.JIE_QI_IN_USE[t], a = this.getJieQiSolar(i);
|
|
681
|
+
if (a && a.getYear() === this._solar.getYear() && a.getMonth() === this._solar.getMonth() && a.getDay() === this._solar.getDay())
|
|
682
|
+
return _._convertJieQi(i);
|
|
683
|
+
}
|
|
684
|
+
return "";
|
|
685
|
+
}
|
|
686
|
+
getJieQi() {
|
|
687
|
+
let t = "";
|
|
688
|
+
for (const n in this._jieQi) {
|
|
689
|
+
const i = this._jieQi[n];
|
|
690
|
+
if (i.getYear() == this._solar.getYear() && i.getMonth() == this._solar.getMonth() && i.getDay() == this._solar.getDay()) {
|
|
691
|
+
t = n;
|
|
692
|
+
break;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
return _._convertJieQi(t);
|
|
696
|
+
}
|
|
697
|
+
getWeek() {
|
|
698
|
+
return this._weekIndex;
|
|
699
|
+
}
|
|
700
|
+
getWeekInChinese() {
|
|
701
|
+
return S.WEEK[this.getWeek()];
|
|
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 || "";
|
|
730
|
+
}
|
|
731
|
+
getFestivals() {
|
|
732
|
+
const t = [], n = e.FESTIVAL[this._month + "-" + this._day];
|
|
733
|
+
return n && t.push(n), Math.abs(this._month) == 12 && this._day >= 29 && this._year != this.next(1).getYear() && t.push(s.getMessage("jr.chuXi")), t;
|
|
734
|
+
}
|
|
735
|
+
getOtherFestivals() {
|
|
736
|
+
const t = [], n = e.OTHER_FESTIVAL[this._month + "-" + this._day];
|
|
737
|
+
n && n.forEach((g) => {
|
|
738
|
+
t.push(g);
|
|
739
|
+
});
|
|
740
|
+
let i = this.getJieQiSolar(s.getMessage("jq.qingMing"));
|
|
741
|
+
const a = this._solar.toYmd();
|
|
742
|
+
a === i.next(-1).toYmd() && t.push("寒食节"), i = this.getJieQiSolar(s.getMessage("jq.liChun"));
|
|
743
|
+
let r = 4 - i.getLunar().getDayGanIndex();
|
|
744
|
+
return r < 0 && (r += 10), a === i.next(r + 40).toYmd() && t.push("春社"), i = this.getJieQiSolar(s.getMessage("jq.liQiu")), r = 4 - i.getLunar().getDayGanIndex(), r < 0 && (r += 10), a === i.next(r + 40).toYmd() && t.push("秋社"), t;
|
|
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
|
+
);
|
|
810
|
+
}
|
|
811
|
+
getYueXiang() {
|
|
812
|
+
return e.YUE_XIANG[this._day];
|
|
813
|
+
}
|
|
814
|
+
getJieQiSolar(t) {
|
|
815
|
+
return this._jieQi[t];
|
|
816
|
+
}
|
|
817
|
+
getSolar() {
|
|
818
|
+
return this._solar;
|
|
819
|
+
}
|
|
820
|
+
getJieQiTable() {
|
|
821
|
+
return this._jieQi;
|
|
822
|
+
}
|
|
823
|
+
getJieQiList() {
|
|
824
|
+
return this._jieQiList;
|
|
825
|
+
}
|
|
826
|
+
getNextJie(t = !1) {
|
|
827
|
+
const n = [];
|
|
828
|
+
for (let i = 0, a = e.JIE_QI_IN_USE.length / 2; i < a; i++)
|
|
829
|
+
n.push(e.JIE_QI_IN_USE[i * 2]);
|
|
830
|
+
return this.getNearJieQi(!0, n, t);
|
|
831
|
+
}
|
|
832
|
+
getPrevJie(t = !1) {
|
|
833
|
+
const n = [];
|
|
834
|
+
for (let i = 0, a = e.JIE_QI_IN_USE.length / 2; i < a; i++)
|
|
835
|
+
n.push(e.JIE_QI_IN_USE[i * 2]);
|
|
836
|
+
return this.getNearJieQi(!1, n, t);
|
|
837
|
+
}
|
|
838
|
+
getNextQi(t = !1) {
|
|
839
|
+
const n = [];
|
|
840
|
+
for (let i = 0, a = e.JIE_QI_IN_USE.length / 2; i < a; i++)
|
|
841
|
+
n.push(e.JIE_QI_IN_USE[i * 2 + 1]);
|
|
842
|
+
return this.getNearJieQi(!0, n, t);
|
|
843
|
+
}
|
|
844
|
+
getPrevQi(t = !1) {
|
|
845
|
+
const n = [];
|
|
846
|
+
for (let i = 0, a = e.JIE_QI_IN_USE.length / 2; i < a; i++)
|
|
847
|
+
n.push(e.JIE_QI_IN_USE[i * 2 + 1]);
|
|
848
|
+
return this.getNearJieQi(!1, n, t);
|
|
849
|
+
}
|
|
850
|
+
getNextJieQi(t = !1) {
|
|
851
|
+
return this.getNearJieQi(!0, [], t);
|
|
852
|
+
}
|
|
853
|
+
getPrevJieQi(t = !1) {
|
|
854
|
+
return this.getNearJieQi(!1, [], t);
|
|
855
|
+
}
|
|
856
|
+
getNearJieQi(t, n, i) {
|
|
857
|
+
let a = "", r = null;
|
|
858
|
+
const g = {};
|
|
859
|
+
let I = !1;
|
|
860
|
+
if (n)
|
|
861
|
+
for (let h = 0, o = n.length; h < o; h++)
|
|
862
|
+
g[n[h]] = !0, I = !0;
|
|
863
|
+
const u = i ? this._solar.toYmd() : this._solar.toYmdHms();
|
|
864
|
+
for (const h in this._jieQi) {
|
|
865
|
+
const o = this._jieQi[h], d = _._convertJieQi(h);
|
|
866
|
+
if (I && !g[d])
|
|
867
|
+
continue;
|
|
868
|
+
const x = i ? o.toYmd() : o.toYmdHms();
|
|
869
|
+
if (t) {
|
|
870
|
+
if (x <= u)
|
|
871
|
+
continue;
|
|
872
|
+
if (r == null)
|
|
873
|
+
a = d, r = o;
|
|
874
|
+
else {
|
|
875
|
+
const y = i ? r.toYmd() : r.toYmdHms();
|
|
876
|
+
x < y && (a = d, r = o);
|
|
877
|
+
}
|
|
878
|
+
} else {
|
|
879
|
+
if (x > u)
|
|
880
|
+
continue;
|
|
881
|
+
if (r == null)
|
|
882
|
+
a = d, r = o;
|
|
883
|
+
else {
|
|
884
|
+
const y = i ? r.toYmd() : r.toYmdHms();
|
|
885
|
+
x > y && (a = d, r = o);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return new G(a, r);
|
|
890
|
+
}
|
|
891
|
+
getCurrentJieQi() {
|
|
892
|
+
let t = null;
|
|
893
|
+
for (const n in this._jieQi) {
|
|
894
|
+
const i = this._jieQi[n];
|
|
895
|
+
if (i.getYear() == this._solar.getYear() && i.getMonth() == this._solar.getMonth() && i.getDay() == this._solar.getDay()) {
|
|
896
|
+
t = new G(_._convertJieQi(n), i);
|
|
897
|
+
break;
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
return t;
|
|
901
|
+
}
|
|
902
|
+
getCurrentJie() {
|
|
903
|
+
for (let t = 0, n = e.JIE_QI_IN_USE.length; t < n; t += 2) {
|
|
904
|
+
const i = e.JIE_QI_IN_USE[t], a = this.getJieQiSolar(i);
|
|
905
|
+
if (a && a.getYear() === this._solar.getYear() && a.getMonth() === this._solar.getMonth() && a.getDay() === this._solar.getDay())
|
|
906
|
+
return new G(_._convertJieQi(i), a);
|
|
907
|
+
}
|
|
908
|
+
return null;
|
|
909
|
+
}
|
|
910
|
+
getCurrentQi() {
|
|
911
|
+
for (let t = 1, n = e.JIE_QI_IN_USE.length; t < n; t += 2) {
|
|
912
|
+
const i = e.JIE_QI_IN_USE[t], a = this.getJieQiSolar(i);
|
|
913
|
+
if (a && a.getYear() === this._solar.getYear() && a.getMonth() === this._solar.getMonth() && a.getDay() === this._solar.getDay())
|
|
914
|
+
return new G(_._convertJieQi(i), a);
|
|
915
|
+
}
|
|
916
|
+
return null;
|
|
917
|
+
}
|
|
918
|
+
next(t) {
|
|
919
|
+
return this._solar.next(t).getLunar();
|
|
920
|
+
}
|
|
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
|
+
toString() {
|
|
976
|
+
return this.getYearInChinese() + "年" + this.getMonthInChinese() + "月" + this.getDayInChinese();
|
|
977
|
+
}
|
|
978
|
+
toFullString() {
|
|
979
|
+
let t = this.toString();
|
|
980
|
+
t += " " + this.getYearInGanZhi() + "(" + this.getYearShengXiao() + ")年", t += " " + this.getMonthInGanZhi() + "(" + this.getMonthShengXiao() + ")月", t += " " + this.getDayInGanZhi() + "(" + this.getDayShengXiao() + ")日", t += " " + this.getTimeZhi() + "(" + this.getTimeShengXiao() + ")时", t += " 纳音[" + this.getYearNaYin() + " " + this.getMonthNaYin() + " " + this.getDayNaYin() + " " + this.getTimeNaYin() + "]", t += " 星期" + this.getWeekInChinese(), this.getFestivals().forEach((i) => {
|
|
981
|
+
t += " (" + i + ")";
|
|
982
|
+
}), this.getOtherFestivals().forEach((i) => {
|
|
983
|
+
t += " (" + i + ")";
|
|
984
|
+
});
|
|
985
|
+
const n = this.getJieQi();
|
|
986
|
+
return n.length > 0 && (t += " [" + n + "]"), t += " " + this.getGong() + "方" + this.getShou(), t += " 星宿[" + this.getXiu() + this.getZheng() + this.getAnimal() + "](" + this.getXiuLuck() + ")", t += " 彭祖百忌[" + this.getPengZuGan() + " " + this.getPengZuZhi() + "]", t += " 喜神方位[" + this.getDayPositionXi() + "](" + this.getDayPositionXiDesc() + ")", t += " 阳贵神方位[" + this.getDayPositionYangGui() + "](" + this.getDayPositionYangGuiDesc() + ")", t += " 阴贵神方位[" + this.getDayPositionYinGui() + "](" + this.getDayPositionYinGuiDesc() + ")", t += " 福神方位[" + this.getDayPositionFu() + "](" + this.getDayPositionFuDesc() + ")", t += " 财神方位[" + this.getDayPositionCai() + "](" + this.getDayPositionCaiDesc() + ")", t += " 冲[" + this.getDayChongDesc() + "]", t += " 煞[" + this.getDaySha() + "]", t;
|
|
987
|
+
}
|
|
988
|
+
getLiuYao() {
|
|
989
|
+
return e.LIU_YAO[(Math.abs(this._month) + this._day - 2) % 6];
|
|
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;
|
|
1005
|
+
}
|
|
1006
|
+
getTime() {
|
|
1007
|
+
return E.fromYmdHms(
|
|
1008
|
+
this._year,
|
|
1009
|
+
this._month,
|
|
1010
|
+
this._day,
|
|
1011
|
+
this._hour,
|
|
1012
|
+
this._minute,
|
|
1013
|
+
this._second
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
1016
|
+
getTimes() {
|
|
1017
|
+
const t = [];
|
|
1018
|
+
t.push(E.fromYmdHms(this._year, this._month, this._day, 0, 0, 0));
|
|
1019
|
+
for (let n = 0; n < 12; n++)
|
|
1020
|
+
t.push(
|
|
1021
|
+
E.fromYmdHms(
|
|
1022
|
+
this._year,
|
|
1023
|
+
this._month,
|
|
1024
|
+
this._day,
|
|
1025
|
+
(n + 1) * 2 - 1,
|
|
1026
|
+
0,
|
|
1027
|
+
0
|
|
1028
|
+
)
|
|
1029
|
+
);
|
|
1030
|
+
return t;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
export {
|
|
1034
|
+
_ as Lunar
|
|
1035
|
+
};
|