@gracefullight/saju 0.1.1 → 0.3.0
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/README.en.md +314 -28
- package/README.md +314 -28
- package/dist/__tests__/four-pillars.test.js +52 -40
- package/dist/__tests__/luck.test.d.ts +2 -0
- package/dist/__tests__/luck.test.d.ts.map +1 -0
- package/dist/__tests__/luck.test.js +33 -0
- package/dist/__tests__/lunar.test.d.ts +2 -0
- package/dist/__tests__/lunar.test.d.ts.map +1 -0
- package/dist/__tests__/lunar.test.js +83 -0
- package/dist/__tests__/relations.test.d.ts +2 -0
- package/dist/__tests__/relations.test.d.ts.map +1 -0
- package/dist/__tests__/relations.test.js +90 -0
- package/dist/__tests__/saju.test.d.ts +2 -0
- package/dist/__tests__/saju.test.d.ts.map +1 -0
- package/dist/__tests__/saju.test.js +133 -0
- package/dist/__tests__/solar-terms.test.d.ts +2 -0
- package/dist/__tests__/solar-terms.test.d.ts.map +1 -0
- package/dist/__tests__/solar-terms.test.js +121 -0
- package/dist/__tests__/strength.test.d.ts +2 -0
- package/dist/__tests__/strength.test.d.ts.map +1 -0
- package/dist/__tests__/strength.test.js +44 -0
- package/dist/__tests__/ten-gods.test.d.ts +2 -0
- package/dist/__tests__/ten-gods.test.d.ts.map +1 -0
- package/dist/__tests__/ten-gods.test.js +119 -0
- package/dist/__tests__/yongshen.test.d.ts +2 -0
- package/dist/__tests__/yongshen.test.d.ts.map +1 -0
- package/dist/__tests__/yongshen.test.js +62 -0
- package/dist/core/four-pillars.d.ts +2 -0
- package/dist/core/four-pillars.d.ts.map +1 -1
- package/dist/core/four-pillars.js +7 -4
- package/dist/core/luck.d.ts +41 -0
- package/dist/core/luck.d.ts.map +1 -0
- package/dist/core/luck.js +96 -0
- package/dist/core/lunar.d.ts +13 -0
- package/dist/core/lunar.d.ts.map +1 -0
- package/dist/core/lunar.js +24 -0
- package/dist/core/relations.d.ts +94 -0
- package/dist/core/relations.d.ts.map +1 -0
- package/dist/core/relations.js +305 -0
- package/dist/core/solar-terms.d.ts +155 -0
- package/dist/core/solar-terms.d.ts.map +1 -0
- package/dist/core/solar-terms.js +266 -0
- package/dist/core/strength.d.ts +18 -0
- package/dist/core/strength.d.ts.map +1 -0
- package/dist/core/strength.js +255 -0
- package/dist/core/ten-gods.d.ts +130 -0
- package/dist/core/ten-gods.d.ts.map +1 -0
- package/dist/core/ten-gods.js +335 -0
- package/dist/core/yongshen.d.ts +20 -0
- package/dist/core/yongshen.d.ts.map +1 -0
- package/dist/core/yongshen.js +216 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -0
- package/package.json +15 -12
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { getStemElement, getBranchElement } from "./ten-gods";
|
|
2
|
+
export const STEM_COMBINATIONS = [
|
|
3
|
+
{ stems: ["甲", "己"], resultElement: "earth" },
|
|
4
|
+
{ stems: ["乙", "庚"], resultElement: "metal" },
|
|
5
|
+
{ stems: ["丙", "辛"], resultElement: "water" },
|
|
6
|
+
{ stems: ["丁", "壬"], resultElement: "wood" },
|
|
7
|
+
{ stems: ["戊", "癸"], resultElement: "fire" },
|
|
8
|
+
];
|
|
9
|
+
export const BRANCH_SIX_COMBINATIONS = [
|
|
10
|
+
{ branches: ["子", "丑"], resultElement: "earth" },
|
|
11
|
+
{ branches: ["寅", "亥"], resultElement: "wood" },
|
|
12
|
+
{ branches: ["卯", "戌"], resultElement: "fire" },
|
|
13
|
+
{ branches: ["辰", "酉"], resultElement: "metal" },
|
|
14
|
+
{ branches: ["巳", "申"], resultElement: "water" },
|
|
15
|
+
{ branches: ["午", "未"], resultElement: "earth" },
|
|
16
|
+
];
|
|
17
|
+
export const BRANCH_TRIPLE_COMBINATIONS = [
|
|
18
|
+
{ branches: ["寅", "午", "戌"], resultElement: "fire" },
|
|
19
|
+
{ branches: ["申", "子", "辰"], resultElement: "water" },
|
|
20
|
+
{ branches: ["亥", "卯", "未"], resultElement: "wood" },
|
|
21
|
+
{ branches: ["巳", "酉", "丑"], resultElement: "metal" },
|
|
22
|
+
];
|
|
23
|
+
export const BRANCH_DIRECTIONAL_COMBINATIONS = [
|
|
24
|
+
{ branches: ["寅", "卯", "辰"], resultElement: "wood" },
|
|
25
|
+
{ branches: ["巳", "午", "未"], resultElement: "fire" },
|
|
26
|
+
{ branches: ["申", "酉", "戌"], resultElement: "metal" },
|
|
27
|
+
{ branches: ["亥", "子", "丑"], resultElement: "water" },
|
|
28
|
+
];
|
|
29
|
+
export const BRANCH_CLASHES = [
|
|
30
|
+
["子", "午"],
|
|
31
|
+
["丑", "未"],
|
|
32
|
+
["寅", "申"],
|
|
33
|
+
["卯", "酉"],
|
|
34
|
+
["辰", "戌"],
|
|
35
|
+
["巳", "亥"],
|
|
36
|
+
];
|
|
37
|
+
export const BRANCH_HARMS = [
|
|
38
|
+
["子", "未"],
|
|
39
|
+
["丑", "午"],
|
|
40
|
+
["寅", "巳"],
|
|
41
|
+
["卯", "辰"],
|
|
42
|
+
["申", "亥"],
|
|
43
|
+
["酉", "戌"],
|
|
44
|
+
];
|
|
45
|
+
export const BRANCH_PUNISHMENTS = [
|
|
46
|
+
{ branches: ["寅", "巳", "申"], type: "무은지형" },
|
|
47
|
+
{ branches: ["丑", "戌", "未"], type: "시세지형" },
|
|
48
|
+
{ branches: ["子", "卯"], type: "무례지형" },
|
|
49
|
+
{ branches: ["辰", "辰"], type: "자형" },
|
|
50
|
+
{ branches: ["午", "午"], type: "자형" },
|
|
51
|
+
{ branches: ["酉", "酉"], type: "자형" },
|
|
52
|
+
{ branches: ["亥", "亥"], type: "자형" },
|
|
53
|
+
];
|
|
54
|
+
export const BRANCH_DESTRUCTIONS = [
|
|
55
|
+
["子", "酉"],
|
|
56
|
+
["丑", "辰"],
|
|
57
|
+
["寅", "亥"],
|
|
58
|
+
["卯", "午"],
|
|
59
|
+
["巳", "申"],
|
|
60
|
+
["未", "戌"],
|
|
61
|
+
];
|
|
62
|
+
const MONTH_BRANCH_ELEMENT_SUPPORT = {
|
|
63
|
+
寅: ["wood"],
|
|
64
|
+
卯: ["wood"],
|
|
65
|
+
辰: ["wood", "earth", "water"],
|
|
66
|
+
巳: ["fire"],
|
|
67
|
+
午: ["fire"],
|
|
68
|
+
未: ["fire", "earth"],
|
|
69
|
+
申: ["metal"],
|
|
70
|
+
酉: ["metal"],
|
|
71
|
+
戌: ["metal", "earth", "fire"],
|
|
72
|
+
亥: ["water"],
|
|
73
|
+
子: ["water"],
|
|
74
|
+
丑: ["water", "earth", "metal"],
|
|
75
|
+
};
|
|
76
|
+
function checkTransformationCondition(resultElement, monthBranch, allBranches, isComplete) {
|
|
77
|
+
const supportedElements = MONTH_BRANCH_ELEMENT_SUPPORT[monthBranch] || [];
|
|
78
|
+
const hasMonthSupport = supportedElements.includes(resultElement);
|
|
79
|
+
const branchElements = allBranches.map((b) => getBranchElement(b));
|
|
80
|
+
const resultElementCount = branchElements.filter((e) => e === resultElement).length;
|
|
81
|
+
const hasStrengthSupport = resultElementCount >= 2;
|
|
82
|
+
if (!isComplete) {
|
|
83
|
+
return { status: "반합", reason: "불완전 합 - 일부 지지 부재" };
|
|
84
|
+
}
|
|
85
|
+
if (hasMonthSupport) {
|
|
86
|
+
return { status: "화", reason: `월령(${monthBranch})이 ${resultElement}을(를) 지지` };
|
|
87
|
+
}
|
|
88
|
+
if (hasStrengthSupport) {
|
|
89
|
+
return { status: "화", reason: `${resultElement} 기세 충분(${resultElementCount}개)` };
|
|
90
|
+
}
|
|
91
|
+
return { status: "불화", reason: "월령 및 기세 미충족으로 화 불성립" };
|
|
92
|
+
}
|
|
93
|
+
function checkStemTransformationCondition(resultElement, monthBranch, allStems) {
|
|
94
|
+
const supportedElements = MONTH_BRANCH_ELEMENT_SUPPORT[monthBranch] || [];
|
|
95
|
+
const hasMonthSupport = supportedElements.includes(resultElement);
|
|
96
|
+
const stemElements = allStems.map((s) => getStemElement(s));
|
|
97
|
+
const resultElementCount = stemElements.filter((e) => e === resultElement).length;
|
|
98
|
+
const hasStrengthSupport = resultElementCount >= 2;
|
|
99
|
+
if (hasMonthSupport) {
|
|
100
|
+
return { status: "화", reason: `월령(${monthBranch})이 ${resultElement}을(를) 지지` };
|
|
101
|
+
}
|
|
102
|
+
if (hasStrengthSupport) {
|
|
103
|
+
return { status: "화", reason: `${resultElement} 기세 충분(${resultElementCount}개)` };
|
|
104
|
+
}
|
|
105
|
+
return { status: "불화", reason: "월령 및 기세 미충족으로 화 불성립" };
|
|
106
|
+
}
|
|
107
|
+
export function analyzeRelations(yearPillar, monthPillar, dayPillar, hourPillar) {
|
|
108
|
+
const monthBranch = monthPillar[1];
|
|
109
|
+
const stems = [
|
|
110
|
+
{ char: yearPillar[0], position: "year" },
|
|
111
|
+
{ char: monthPillar[0], position: "month" },
|
|
112
|
+
{ char: dayPillar[0], position: "day" },
|
|
113
|
+
{ char: hourPillar[0], position: "hour" },
|
|
114
|
+
];
|
|
115
|
+
const branches = [
|
|
116
|
+
{ char: yearPillar[1], position: "year" },
|
|
117
|
+
{ char: monthPillar[1], position: "month" },
|
|
118
|
+
{ char: dayPillar[1], position: "day" },
|
|
119
|
+
{ char: hourPillar[1], position: "hour" },
|
|
120
|
+
];
|
|
121
|
+
const allStemChars = stems.map((s) => s.char);
|
|
122
|
+
const allBranchChars = branches.map((b) => b.char);
|
|
123
|
+
const combinations = [];
|
|
124
|
+
const clashes = [];
|
|
125
|
+
const harms = [];
|
|
126
|
+
const punishments = [];
|
|
127
|
+
const destructions = [];
|
|
128
|
+
for (let i = 0; i < stems.length; i++) {
|
|
129
|
+
for (let j = i + 1; j < stems.length; j++) {
|
|
130
|
+
const s1 = stems[i];
|
|
131
|
+
const s2 = stems[j];
|
|
132
|
+
for (const combo of STEM_COMBINATIONS) {
|
|
133
|
+
if ((s1.char === combo.stems[0] && s2.char === combo.stems[1]) ||
|
|
134
|
+
(s1.char === combo.stems[1] && s2.char === combo.stems[0])) {
|
|
135
|
+
const transform = checkStemTransformationCondition(combo.resultElement, monthBranch, allStemChars);
|
|
136
|
+
combinations.push({
|
|
137
|
+
type: "천간합",
|
|
138
|
+
pair: [s1.char, s2.char],
|
|
139
|
+
positions: [s1.position, s2.position],
|
|
140
|
+
resultElement: combo.resultElement,
|
|
141
|
+
transformStatus: transform.status,
|
|
142
|
+
transformReason: transform.reason,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
for (let i = 0; i < branches.length; i++) {
|
|
149
|
+
for (let j = i + 1; j < branches.length; j++) {
|
|
150
|
+
const b1 = branches[i];
|
|
151
|
+
const b2 = branches[j];
|
|
152
|
+
for (const combo of BRANCH_SIX_COMBINATIONS) {
|
|
153
|
+
if ((b1.char === combo.branches[0] && b2.char === combo.branches[1]) ||
|
|
154
|
+
(b1.char === combo.branches[1] && b2.char === combo.branches[0])) {
|
|
155
|
+
const transform = checkTransformationCondition(combo.resultElement, monthBranch, allBranchChars, true);
|
|
156
|
+
combinations.push({
|
|
157
|
+
type: "육합",
|
|
158
|
+
pair: [b1.char, b2.char],
|
|
159
|
+
positions: [b1.position, b2.position],
|
|
160
|
+
resultElement: combo.resultElement,
|
|
161
|
+
transformStatus: transform.status,
|
|
162
|
+
transformReason: transform.reason,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
for (const clash of BRANCH_CLASHES) {
|
|
167
|
+
if ((b1.char === clash[0] && b2.char === clash[1]) ||
|
|
168
|
+
(b1.char === clash[1] && b2.char === clash[0])) {
|
|
169
|
+
clashes.push({
|
|
170
|
+
type: "충",
|
|
171
|
+
pair: [b1.char, b2.char],
|
|
172
|
+
positions: [b1.position, b2.position],
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
for (const harm of BRANCH_HARMS) {
|
|
177
|
+
if ((b1.char === harm[0] && b2.char === harm[1]) ||
|
|
178
|
+
(b1.char === harm[1] && b2.char === harm[0])) {
|
|
179
|
+
harms.push({
|
|
180
|
+
type: "해",
|
|
181
|
+
pair: [b1.char, b2.char],
|
|
182
|
+
positions: [b1.position, b2.position],
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
for (const dest of BRANCH_DESTRUCTIONS) {
|
|
187
|
+
if ((b1.char === dest[0] && b2.char === dest[1]) ||
|
|
188
|
+
(b1.char === dest[1] && b2.char === dest[0])) {
|
|
189
|
+
destructions.push({
|
|
190
|
+
type: "파",
|
|
191
|
+
pair: [b1.char, b2.char],
|
|
192
|
+
positions: [b1.position, b2.position],
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const branchChars = branches.map((b) => b.char);
|
|
199
|
+
for (const combo of BRANCH_TRIPLE_COMBINATIONS) {
|
|
200
|
+
const matched = combo.branches.filter((b) => branchChars.includes(b));
|
|
201
|
+
if (matched.length >= 2) {
|
|
202
|
+
const positions = matched.map((m) => branches.find((b) => b.char === m).position);
|
|
203
|
+
const isComplete = matched.length === 3;
|
|
204
|
+
const transform = checkTransformationCondition(combo.resultElement, monthBranch, allBranchChars, isComplete);
|
|
205
|
+
combinations.push({
|
|
206
|
+
type: "삼합",
|
|
207
|
+
branches: matched,
|
|
208
|
+
positions,
|
|
209
|
+
resultElement: combo.resultElement,
|
|
210
|
+
isComplete,
|
|
211
|
+
transformStatus: transform.status,
|
|
212
|
+
transformReason: transform.reason,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
for (const combo of BRANCH_DIRECTIONAL_COMBINATIONS) {
|
|
217
|
+
const matched = combo.branches.filter((b) => branchChars.includes(b));
|
|
218
|
+
if (matched.length >= 2) {
|
|
219
|
+
const positions = matched.map((m) => branches.find((b) => b.char === m).position);
|
|
220
|
+
const isComplete = matched.length === 3;
|
|
221
|
+
const transform = checkTransformationCondition(combo.resultElement, monthBranch, allBranchChars, isComplete);
|
|
222
|
+
combinations.push({
|
|
223
|
+
type: "방합",
|
|
224
|
+
branches: matched,
|
|
225
|
+
positions,
|
|
226
|
+
resultElement: combo.resultElement,
|
|
227
|
+
isComplete,
|
|
228
|
+
transformStatus: transform.status,
|
|
229
|
+
transformReason: transform.reason,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
for (const punishment of BRANCH_PUNISHMENTS) {
|
|
234
|
+
const matched = punishment.branches.filter((b) => branchChars.includes(b));
|
|
235
|
+
const isTriple = punishment.branches.length === 3;
|
|
236
|
+
const isSelfPunishment = punishment.type === "자형";
|
|
237
|
+
if (isSelfPunishment) {
|
|
238
|
+
const count = branchChars.filter((b) => b === punishment.branches[0]).length;
|
|
239
|
+
if (count >= 2) {
|
|
240
|
+
punishments.push({
|
|
241
|
+
type: "형",
|
|
242
|
+
branches: Array(count).fill(punishment.branches[0]),
|
|
243
|
+
positions: branches
|
|
244
|
+
.filter((b) => b.char === punishment.branches[0])
|
|
245
|
+
.map((b) => b.position),
|
|
246
|
+
punishmentType: punishment.type,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else if (isTriple && matched.length >= 2) {
|
|
251
|
+
const positions = matched.map((m) => branches.find((b) => b.char === m).position);
|
|
252
|
+
punishments.push({
|
|
253
|
+
type: "형",
|
|
254
|
+
branches: matched,
|
|
255
|
+
positions,
|
|
256
|
+
punishmentType: punishment.type,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
else if (!isTriple && matched.length === 2) {
|
|
260
|
+
const positions = matched.map((m) => branches.find((b) => b.char === m).position);
|
|
261
|
+
punishments.push({
|
|
262
|
+
type: "형",
|
|
263
|
+
branches: matched,
|
|
264
|
+
positions,
|
|
265
|
+
punishmentType: punishment.type,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const all = [...combinations, ...clashes, ...harms, ...punishments, ...destructions];
|
|
270
|
+
return {
|
|
271
|
+
combinations,
|
|
272
|
+
clashes,
|
|
273
|
+
harms,
|
|
274
|
+
punishments,
|
|
275
|
+
destructions,
|
|
276
|
+
all,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
export function findStemCombination(stem1, stem2) {
|
|
280
|
+
for (const combo of STEM_COMBINATIONS) {
|
|
281
|
+
if ((stem1 === combo.stems[0] && stem2 === combo.stems[1]) ||
|
|
282
|
+
(stem1 === combo.stems[1] && stem2 === combo.stems[0])) {
|
|
283
|
+
return combo;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
export function findBranchClash(branch1, branch2) {
|
|
289
|
+
for (const clash of BRANCH_CLASHES) {
|
|
290
|
+
if ((branch1 === clash[0] && branch2 === clash[1]) ||
|
|
291
|
+
(branch1 === clash[1] && branch2 === clash[0])) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
export function findBranchSixCombination(branch1, branch2) {
|
|
298
|
+
for (const combo of BRANCH_SIX_COMBINATIONS) {
|
|
299
|
+
if ((branch1 === combo.branches[0] && branch2 === combo.branches[1]) ||
|
|
300
|
+
(branch1 === combo.branches[1] && branch2 === combo.branches[0])) {
|
|
301
|
+
return combo;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { DateAdapter } from "@/adapters/date-adapter";
|
|
2
|
+
/**
|
|
3
|
+
* 24 Solar Terms (二十四節氣)
|
|
4
|
+
* Each term corresponds to a specific solar longitude
|
|
5
|
+
*/
|
|
6
|
+
export declare const SOLAR_TERMS: readonly [{
|
|
7
|
+
readonly name: "소한";
|
|
8
|
+
readonly hanja: "小寒";
|
|
9
|
+
readonly longitude: 285;
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "대한";
|
|
12
|
+
readonly hanja: "大寒";
|
|
13
|
+
readonly longitude: 300;
|
|
14
|
+
}, {
|
|
15
|
+
readonly name: "입춘";
|
|
16
|
+
readonly hanja: "立春";
|
|
17
|
+
readonly longitude: 315;
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "우수";
|
|
20
|
+
readonly hanja: "雨水";
|
|
21
|
+
readonly longitude: 330;
|
|
22
|
+
}, {
|
|
23
|
+
readonly name: "경칩";
|
|
24
|
+
readonly hanja: "驚蟄";
|
|
25
|
+
readonly longitude: 345;
|
|
26
|
+
}, {
|
|
27
|
+
readonly name: "춘분";
|
|
28
|
+
readonly hanja: "春分";
|
|
29
|
+
readonly longitude: 0;
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "청명";
|
|
32
|
+
readonly hanja: "淸明";
|
|
33
|
+
readonly longitude: 15;
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "곡우";
|
|
36
|
+
readonly hanja: "穀雨";
|
|
37
|
+
readonly longitude: 30;
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "입하";
|
|
40
|
+
readonly hanja: "立夏";
|
|
41
|
+
readonly longitude: 45;
|
|
42
|
+
}, {
|
|
43
|
+
readonly name: "소만";
|
|
44
|
+
readonly hanja: "小滿";
|
|
45
|
+
readonly longitude: 60;
|
|
46
|
+
}, {
|
|
47
|
+
readonly name: "망종";
|
|
48
|
+
readonly hanja: "芒種";
|
|
49
|
+
readonly longitude: 75;
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "하지";
|
|
52
|
+
readonly hanja: "夏至";
|
|
53
|
+
readonly longitude: 90;
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "소서";
|
|
56
|
+
readonly hanja: "小暑";
|
|
57
|
+
readonly longitude: 105;
|
|
58
|
+
}, {
|
|
59
|
+
readonly name: "대서";
|
|
60
|
+
readonly hanja: "大暑";
|
|
61
|
+
readonly longitude: 120;
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "입추";
|
|
64
|
+
readonly hanja: "立秋";
|
|
65
|
+
readonly longitude: 135;
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "처서";
|
|
68
|
+
readonly hanja: "處暑";
|
|
69
|
+
readonly longitude: 150;
|
|
70
|
+
}, {
|
|
71
|
+
readonly name: "백로";
|
|
72
|
+
readonly hanja: "白露";
|
|
73
|
+
readonly longitude: 165;
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "추분";
|
|
76
|
+
readonly hanja: "秋分";
|
|
77
|
+
readonly longitude: 180;
|
|
78
|
+
}, {
|
|
79
|
+
readonly name: "한로";
|
|
80
|
+
readonly hanja: "寒露";
|
|
81
|
+
readonly longitude: 195;
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "상강";
|
|
84
|
+
readonly hanja: "霜降";
|
|
85
|
+
readonly longitude: 210;
|
|
86
|
+
}, {
|
|
87
|
+
readonly name: "입동";
|
|
88
|
+
readonly hanja: "立冬";
|
|
89
|
+
readonly longitude: 225;
|
|
90
|
+
}, {
|
|
91
|
+
readonly name: "소설";
|
|
92
|
+
readonly hanja: "小雪";
|
|
93
|
+
readonly longitude: 240;
|
|
94
|
+
}, {
|
|
95
|
+
readonly name: "대설";
|
|
96
|
+
readonly hanja: "大雪";
|
|
97
|
+
readonly longitude: 255;
|
|
98
|
+
}, {
|
|
99
|
+
readonly name: "동지";
|
|
100
|
+
readonly hanja: "冬至";
|
|
101
|
+
readonly longitude: 270;
|
|
102
|
+
}];
|
|
103
|
+
export type SolarTermName = (typeof SOLAR_TERMS)[number]["name"];
|
|
104
|
+
export type SolarTermHanja = (typeof SOLAR_TERMS)[number]["hanja"];
|
|
105
|
+
export interface SolarTerm {
|
|
106
|
+
name: SolarTermName;
|
|
107
|
+
hanja: SolarTermHanja;
|
|
108
|
+
longitude: number;
|
|
109
|
+
}
|
|
110
|
+
export interface SolarTermDateInfo {
|
|
111
|
+
year: number;
|
|
112
|
+
month: number;
|
|
113
|
+
day: number;
|
|
114
|
+
hour: number;
|
|
115
|
+
minute: number;
|
|
116
|
+
}
|
|
117
|
+
export interface SolarTermInfo {
|
|
118
|
+
/** Current solar term (the one that has passed) */
|
|
119
|
+
current: SolarTerm;
|
|
120
|
+
/** Date when the current solar term started */
|
|
121
|
+
currentDate: SolarTermDateInfo;
|
|
122
|
+
/** Milliseconds timestamp of current solar term (for calculations) */
|
|
123
|
+
currentMillis: number;
|
|
124
|
+
/** Days elapsed since the current solar term */
|
|
125
|
+
daysSinceCurrent: number;
|
|
126
|
+
/** Next solar term (upcoming) */
|
|
127
|
+
next: SolarTerm;
|
|
128
|
+
/** Date when the next solar term will start */
|
|
129
|
+
nextDate: SolarTermDateInfo;
|
|
130
|
+
/** Milliseconds timestamp of next solar term (for calculations) */
|
|
131
|
+
nextMillis: number;
|
|
132
|
+
/** Days until the next solar term */
|
|
133
|
+
daysUntilNext: number;
|
|
134
|
+
/** Previous "節" (Jie) - the solar term that marks month boundary (for major luck calculation) */
|
|
135
|
+
prevJie: SolarTerm;
|
|
136
|
+
/** Date of previous Jie */
|
|
137
|
+
prevJieDate: SolarTermDateInfo;
|
|
138
|
+
/** Milliseconds timestamp of previous Jie */
|
|
139
|
+
prevJieMillis: number;
|
|
140
|
+
/** Next "節" (Jie) - the solar term that marks month boundary (for major luck calculation) */
|
|
141
|
+
nextJie: SolarTerm;
|
|
142
|
+
/** Date of next Jie */
|
|
143
|
+
nextJieDate: SolarTermDateInfo;
|
|
144
|
+
/** Milliseconds timestamp of next Jie */
|
|
145
|
+
nextJieMillis: number;
|
|
146
|
+
}
|
|
147
|
+
export declare function analyzeSolarTerms<T>(adapter: DateAdapter<T>, dtLocal: T): SolarTermInfo;
|
|
148
|
+
/**
|
|
149
|
+
* Get all solar term dates for a given year
|
|
150
|
+
*/
|
|
151
|
+
export declare function getSolarTermsForYear<T>(adapter: DateAdapter<T>, year: number, timezone: string): Array<{
|
|
152
|
+
term: SolarTerm;
|
|
153
|
+
date: SolarTermDateInfo;
|
|
154
|
+
}>;
|
|
155
|
+
//# sourceMappingURL=solar-terms.d.ts.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