Skip to content

Commit

Permalink
Merge pull request #158 from SylarLong/feat-157
Browse files Browse the repository at this point in the history
🪄 add 12 palaces for age
  • Loading branch information
SylarLong authored Dec 19, 2023
2 parents 7e93af9 + 51b9d31 commit 1118193
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
🇨🇳

- 新增童限指示 #154
- 新增小限12宫 #157

🇺🇸

- add childhood scope indicator #154
- add 12 palaces for age #157

## v2.1.0

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iztro",
"version": "2.1.0",
"version": "2.2.0",
"description": "轻量级紫微斗数星盘生成库。可以通过出生年月日获取到紫微斗数星盘信息、生肖、星座等信息。A lightweight kit to astrolabe generator of The Purple Star Astrology (Zi Wei Dou Shu). The Purple Star Astrology(Zi Wei Dou Shu) is a Chinese ancient astrology. You're able to get your horoscope and personality from the astrolabe",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
12 changes: 11 additions & 1 deletion src/astro/FunctionalAstrolabe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ const _getHoroscopeBySolarDate = (
let dailyIndex = -1;
// 流时索引
let hourlyIndex = -1;
// 小限天干
let heavenlyStemOfAge: HeavenlyStemName = 'jia';
// 小限地支
let earthlyBranchOfAge: EarthlyBranchName = 'zi';

// 查询大限索引
$.palaces.some(({ decadal }, index) => {
Expand Down Expand Up @@ -98,9 +102,11 @@ const _getHoroscopeBySolarDate = (
}

// 查询小限索引
$.palaces.some(({ ages }, index) => {
$.palaces.some(({ ages, heavenlyStem, earthlyBranch }, index) => {
if (ages.includes(nominalAge)) {
ageIndex = index;
heavenlyStemOfAge = heavenlyStem;
earthlyBranchOfAge = earthlyBranch;

return true;
}
Expand Down Expand Up @@ -136,6 +142,10 @@ const _getHoroscopeBySolarDate = (
index: ageIndex,
nominalAge,
name: t('turn'),
heavenlyStem: heavenlyStemOfAge,
earthlyBranch: earthlyBranchOfAge,
palaceNames: getPalaceNames(ageIndex),
mutagen: getMutagensByHeavenlyStem(heavenlyStemOfAge),
},
yearly: {
index: yearlyIndex,
Expand Down
7 changes: 1 addition & 6 deletions src/data/types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,11 @@ export type Horoscope = {
* 小限
*
* @property
* - index 小限所在宫位索引
* - nominalAge 虚岁
*/
age: {
/** 小限所在宫位索引 */
index: number;
age: HoroscopeItem & {
/** 虚岁 */
nominalAge: number;
/** 名称 */
name: string;
};
/** 流年 */
yearly: HoroscopeItem & { yearlyDecStar: { jiangqian12: StarName[]; suiqian12: StarName[] } };
Expand Down

0 comments on commit 1118193

Please sign in to comment.