Skip to content

Commit 40fcfa2

Browse files
committed
🛠️ 修改默认排盘月份按农历初一为分界。
1 parent ca8f690 commit 40fcfa2

File tree

6 files changed

+28
-20
lines changed

6 files changed

+28
-20
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
- 🛠️ 修复(fix)
88
- 🧹 琐事(Chore)
99

10+
## v2.5.5
11+
12+
- 🛠️ 修复(fix)
13+
14+
- 修改默认排盘月份按农历初一为分界。
15+
1016
## v2.5.4
1117

1218
- 🛠️ 修复(fix)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iztro",
3-
"version": "2.5.4",
3+
"version": "2.5.5",
44
"description": "轻量级紫微斗数星盘生成库。可以通过出生年月日获取到紫微斗数星盘信息、生肖、星座等信息。This is a lightweight kit for generating astrolabes for Zi Wei Dou Shu (The Purple Star Astrology), an ancient Chinese astrology. It allows you to obtain your horoscope and personality analysis.",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -69,7 +69,7 @@
6969
"dependencies": {
7070
"dayjs": "^1.11.10",
7171
"i18next": "^23.5.1",
72-
"lunar-lite": "^0.2.7",
72+
"lunar-lite": "^0.2.8",
7373
"lunar-typescript": "^1.7.8"
7474
}
7575
}

src/__tests__/astro/astro.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ describe('Astrolabe', () => {
619619

620620
expect(result).toHaveProperty('solarDate', '2000-2-4');
621621
expect(result).toHaveProperty('lunarDate', '一九九九年腊月廿九');
622-
expect(result).toHaveProperty('chineseDate', '庚辰 丁丑 壬辰 壬寅');
622+
expect(result).toHaveProperty('chineseDate', '庚辰 己丑 壬辰 壬寅');
623623
expect(result).toHaveProperty('time', '寅时');
624624
expect(result).toHaveProperty('zodiac', '龙');
625625
expect(result).toHaveProperty('earthlyBranchOfSoulPalace', '亥');
@@ -647,13 +647,13 @@ describe('Astrolabe', () => {
647647
});
648648

649649
test('bySolar() with `normal` year divider', () => {
650-
astro.config({ yearDivide: 'normal' });
650+
astro.config({ yearDivide: 'normal', horoscopeDivide: 'normal' });
651651

652652
const result = astro.bySolar('1980-2-14', 0, 'male', true);
653653

654654
expect(result).toHaveProperty('solarDate', '1980-2-14');
655655
expect(result).toHaveProperty('lunarDate', '一九七九年腊月廿八');
656-
expect(result).toHaveProperty('chineseDate', '己未 戊寅 丁巳 庚子');
656+
expect(result).toHaveProperty('chineseDate', '己未 丁丑 丁巳 庚子');
657657
expect(result).toHaveProperty('time', '早子时');
658658
expect(result).toHaveProperty('zodiac', '羊');
659659
expect(result).toHaveProperty('earthlyBranchOfSoulPalace', '丑');
@@ -665,8 +665,8 @@ describe('Astrolabe', () => {
665665
expect(result.palaces[0].decadal).toHaveProperty('range', [112, 121]);
666666
const horoscope = result.horoscope('1980-2-14');
667667

668-
expect(horoscope.yearly).toHaveProperty('earthlyBranch', '');
669-
expect(horoscope.yearly).toHaveProperty('heavenlyStem', '');
668+
expect(horoscope.yearly).toHaveProperty('earthlyBranch', '');
669+
expect(horoscope.yearly).toHaveProperty('heavenlyStem', '');
670670
});
671671

672672
test('check special date `1995-3-30`', () => {
@@ -751,6 +751,7 @@ describe('Astrolabe', () => {
751751
language: 'zh-CN',
752752
config: {
753753
yearDivide: 'exact',
754+
horoscopeDivide: 'exact',
754755
},
755756
});
756757

@@ -783,7 +784,7 @@ describe('Astrolabe', () => {
783784

784785
expect(result).toHaveProperty('solarDate', '1980-2-14');
785786
expect(result).toHaveProperty('lunarDate', '一九七九年腊月廿八');
786-
expect(result).toHaveProperty('chineseDate', '己未 戊寅 丁巳 庚子');
787+
expect(result).toHaveProperty('chineseDate', '己未 丁丑 丁巳 庚子');
787788
expect(result).toHaveProperty('time', '早子时');
788789
expect(result).toHaveProperty('zodiac', '羊');
789790
expect(result).toHaveProperty('earthlyBranchOfSoulPalace', '丑');

src/astro/FunctionalAstrolabe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const _getHoroscopeBySolarDate = (
3737
targetDate,
3838
timeIndex || convertTimeIndex,
3939
{
40-
// 运限是以立春为界,但为了满足部分流派允许配置
40+
// 允许配置运限分割点
4141
year: getConfig().horoscopeDivide,
4242
month: getConfig().horoscopeDivide,
4343
},

src/astro/astro.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const _brightness: Partial<Record<StarKey, BrightnessKey[]>> = {};
3333
* exact:立春分界
3434
*/
3535
let _yearDivide: 'normal' | 'exact' = 'normal';
36-
let _horoscopeDivide: 'normal' | 'exact' = 'exact';
36+
let _horoscopeDivide: 'normal' | 'exact' = 'normal';
3737

3838
/**
3939
* 小限分割点,默认为生日。
@@ -181,6 +181,7 @@ export function bySolar<T extends FunctionalAstrolabe>(
181181

182182
const { yearly } = getHeavenlyStemAndEarthlyBranchBySolarDate(solarDate, tIndex, {
183183
year: getConfig().yearDivide,
184+
month: getConfig().horoscopeDivide,
184185
});
185186
const earthlyBranchOfYear = kot<EarthlyBranchKey>(yearly[1], 'Earthly');
186187
const heavenlyStemOfYear = kot<HeavenlyStemKey>(yearly[0], 'Heavenly');

yarn.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3845,23 +3845,23 @@ lru-cache@^6.0.0:
38453845
dependencies:
38463846
yallist "^4.0.0"
38473847

3848-
lunar-lite@^0.2.7:
3849-
version "0.2.7"
3850-
resolved "https://registry.npmjs.org/lunar-lite/-/lunar-lite-0.2.7.tgz#3b68df72870627158acfa31d26d0f5fe9b441bbd"
3851-
integrity sha512-ePsbfKBUhnHINckdb5svyjSiYItxR6BySSmZ5Wjc5yRwKX8nbIVRBB0hwrW/NpZP5SuSXz1TSvuM/TVP9brZmw==
3848+
lunar-lite@^0.2.8:
3849+
version "0.2.8"
3850+
resolved "https://registry.npmjs.org/lunar-lite/-/lunar-lite-0.2.8.tgz#a0caad44ee65c75d28c9430c890c544f9c5572ee"
3851+
integrity sha512-Y4tba4RaIFI0ikImJhgoEsyqtDE64lJIM3yFwRX01dbmagCDq7rNmpDQFrSFFy4WXeuywdRVFpIBoT1GGCEizw==
38523852
dependencies:
3853-
lunar-typescript "^1.7.5"
3854-
3855-
lunar-typescript@^1.7.5:
3856-
version "1.7.5"
3857-
resolved "https://registry.npmjs.org/lunar-typescript/-/lunar-typescript-1.7.5.tgz#8a407f9db10aaf896f1477564dbfef741463e245"
3858-
integrity sha512-AlOwYrxHRCR9Plba5TlZY0NVv6aFobmR1gxfiAE1KxjDzBXoDtT2KrsBYCVaErGokiL8qLMS1FNwGPiPRX2a4g==
3853+
lunar-typescript "^1.8.6"
38593854

38603855
lunar-typescript@^1.7.8:
38613856
version "1.7.8"
38623857
resolved "https://registry.npmjs.org/lunar-typescript/-/lunar-typescript-1.7.8.tgz#f051ea5a3a5f731581ed37fe4638df8b42ce3b52"
38633858
integrity sha512-i1rjc1eDHUF4k8NfpYxar3ZKtxyVHOGnR+yVTMS8jMy74ugq7KeHI+8T1XIvB3uojpBq6asywe7z25PmI3VLPw==
38643859

3860+
lunar-typescript@^1.8.6:
3861+
version "1.8.6"
3862+
resolved "https://registry.npmjs.org/lunar-typescript/-/lunar-typescript-1.8.6.tgz#9ecadd8610369f800bf46a517da7f6c598f6491d"
3863+
integrity sha512-5Eo4T/cnuXfrgO4k5LCpOGHIUOuz5hCF/IfNv0T29WY2shR36Hiz+ecN9WjnUuxUKhql9gbOkPaQoqLFKtPRNA==
3864+
38653865
make-dir@^4.0.0:
38663866
version "4.0.0"
38673867
resolved "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz"

0 commit comments

Comments
 (0)