-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.1.0 更改了getYear()、getMonth()、getDay()的返回类型,非兼容性更新;新增吉神宜趋、凶神宜忌;新增每日宜…
…忌、时辰宜忌;修复:农历日获取时辰列表遇闰月报错的问题。
- Loading branch information
Showing
9 changed files
with
571 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import {suite, test} from '@testdeck/mocha'; | ||
import {God, LunarDay, SolarDay} from '../lib'; | ||
import {deepEqual} from 'assert'; | ||
|
||
@suite | ||
class GodTest { | ||
@test | ||
test0() { | ||
const lunar: LunarDay = SolarDay.fromYmd(2004, 2, 16).getLunarDay(); | ||
const gods: God[] = lunar.getGods(); | ||
const ji: string[] = []; | ||
gods.forEach(god => { | ||
if ('吉' == god.getLuck().getName()) { | ||
ji.push(god.getName()); | ||
} | ||
}); | ||
|
||
const xiong: string[] = []; | ||
gods.forEach(god => { | ||
if ('凶' == god.getLuck().getName()) { | ||
xiong.push(god.getName()); | ||
} | ||
}); | ||
|
||
deepEqual(ji, ['天恩', '续世', '明堂']); | ||
deepEqual(xiong, ['月煞', '月虚', '血支', '天贼', '五虚', '土符', '归忌', '血忌']); | ||
} | ||
|
||
@test | ||
test1() { | ||
const lunar: LunarDay = SolarDay.fromYmd(2029, 11, 16).getLunarDay(); | ||
const gods: God[] = lunar.getGods(); | ||
const ji: string[] = []; | ||
gods.forEach(god => { | ||
if ('吉' == god.getLuck().getName()) { | ||
ji.push(god.getName()); | ||
} | ||
}); | ||
|
||
const xiong: string[] = []; | ||
gods.forEach(god => { | ||
if ('凶' == god.getLuck().getName()) { | ||
xiong.push(god.getName()); | ||
} | ||
}); | ||
|
||
deepEqual(ji, ['天德合', '月空', '天恩', '益后', '金匮']); | ||
deepEqual(xiong, ['月煞', '月虚', '血支', '五虚']); | ||
} | ||
|
||
@test | ||
test2() { | ||
const lunar: LunarDay = SolarDay.fromYmd(1954, 7, 16).getLunarDay(); | ||
const gods: God[] = lunar.getGods(); | ||
const ji: string[] = []; | ||
gods.forEach(god => { | ||
if ('吉' == god.getLuck().getName()) { | ||
ji.push(god.getName()); | ||
} | ||
}); | ||
|
||
const xiong: string[] = []; | ||
gods.forEach(god => { | ||
if ('凶' == god.getLuck().getName()) { | ||
xiong.push(god.getName()); | ||
} | ||
}); | ||
|
||
deepEqual(ji, ['民日', '天巫', '福德', '天仓', '不将', '续世', '除神', '鸣吠']); | ||
deepEqual(xiong, ['劫煞', '天贼', '五虚', '五离']); | ||
} | ||
|
||
@test | ||
test3() { | ||
const lunar: LunarDay = SolarDay.fromYmd(2024, 12, 27).getLunarDay(); | ||
const gods: God[] = lunar.getGods(); | ||
const ji: string[] = []; | ||
gods.forEach(god => { | ||
if ('吉' == god.getLuck().getName()) { | ||
ji.push(god.getName()); | ||
} | ||
}); | ||
|
||
const xiong: string[] = []; | ||
gods.forEach(god => { | ||
if ('凶' == god.getLuck().getName()) { | ||
xiong.push(god.getName()); | ||
} | ||
}); | ||
|
||
deepEqual(ji, ['天恩', '四相', '阴德', '守日', '吉期', '六合', '普护', '宝光']); | ||
deepEqual(xiong, ['三丧', '鬼哭']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import {suite, test} from '@testdeck/mocha'; | ||
import {SolarDay, SolarTime} from '../lib'; | ||
import {deepEqual} from 'assert'; | ||
|
||
@suite | ||
class TabooTest { | ||
@test | ||
test0() { | ||
const taboos: string[] = []; | ||
SolarDay.fromYmd(2024, 6, 26).getLunarDay().getRecommends().forEach(t => { | ||
taboos.push(t.getName()); | ||
}); | ||
|
||
deepEqual(taboos, ['嫁娶', '祭祀', '理发', '作灶', '修饰垣墙', '平治道涂', '整手足甲', '沐浴', '冠笄']); | ||
} | ||
|
||
@test | ||
test1() { | ||
const taboos: string[] = []; | ||
SolarDay.fromYmd(2024, 6, 26).getLunarDay().getAvoids().forEach(t => { | ||
taboos.push(t.getName()); | ||
}); | ||
|
||
deepEqual(taboos, ['破土', '出行', '栽种']); | ||
} | ||
|
||
@test | ||
test2() { | ||
const taboos: string[] = []; | ||
SolarTime.fromYmdHms(2024, 6, 25, 4, 0, 0).getLunarHour().getRecommends().forEach(t => { | ||
taboos.push(t.getName()); | ||
}); | ||
|
||
deepEqual(taboos, []); | ||
} | ||
|
||
@test | ||
test3() { | ||
const taboos: string[] = []; | ||
SolarTime.fromYmdHms(2024, 6, 25, 4, 0, 0).getLunarHour().getAvoids().forEach(t => { | ||
taboos.push(t.getName()); | ||
}); | ||
|
||
deepEqual(taboos, ['诸事不宜']); | ||
} | ||
|
||
@test | ||
test4() { | ||
const taboos: string[] = []; | ||
SolarTime.fromYmdHms(2024, 4, 22, 0, 0, 0).getLunarHour().getRecommends().forEach(t => { | ||
taboos.push(t.getName()); | ||
}); | ||
|
||
deepEqual(taboos, ['嫁娶', '交易', '开市', '安床', '祭祀', '求财']); | ||
} | ||
|
||
@test | ||
test5() { | ||
const taboos: string[] = []; | ||
SolarTime.fromYmdHms(2024, 4, 22, 0, 0, 0).getLunarHour().getAvoids().forEach(t => { | ||
taboos.push(t.getName()); | ||
}); | ||
|
||
deepEqual(taboos, ['出行', '移徙', '赴任', '词讼', '祈福', '修造', '求嗣']); | ||
} | ||
|
||
@test | ||
test6() { | ||
const taboos: string[] = []; | ||
SolarDay.fromYmd(2021, 3, 7).getLunarDay().getRecommends().forEach(t => { | ||
taboos.push(t.getName()); | ||
}); | ||
|
||
deepEqual(taboos, ['裁衣', '经络', '伐木', '开柱眼', '拆卸', '修造', '动土', '上梁', '合脊', '合寿木', '入殓', '除服', '成服', '移柩', '破土', '安葬', '启钻', '修坟', '立碑']); | ||
} | ||
|
||
} |