Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b0ed30657 | ||
|
|
e9e23ee38f | ||
|
|
0dddcf841f | ||
|
|
7a71e07ade |
@@ -181,3 +181,11 @@ test('test11', () => {
|
|||||||
test('test12', () => {
|
test('test12', () => {
|
||||||
expect(Solar.fromYmdHms('1999', '06', '07', '09', '11', '00').getLunar().getEightChar().toString()).toBe('己卯 庚午 庚寅 辛巳');
|
expect(Solar.fromYmdHms('1999', '06', '07', '09', '11', '00').getLunar().getEightChar().toString()).toBe('己卯 庚午 庚寅 辛巳');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('流月', () => {
|
||||||
|
const solar = Solar.fromYmdHms(2023, 5, 3, 9, 0, 0);
|
||||||
|
const lunar = solar.getLunar();
|
||||||
|
const eightChar = lunar.getEightChar();
|
||||||
|
const yun = eightChar.getYun(1);
|
||||||
|
expect(yun.getDaYun()[0].getLiuNian()[0].getLiuYue()[0].getGanZhi()).toBe('甲寅');
|
||||||
|
});
|
||||||
|
|||||||
@@ -13,3 +13,8 @@ test('test2()', () => {
|
|||||||
expect(foto.getGong()).toBe('东');
|
expect(foto.getGong()).toBe('东');
|
||||||
expect(foto.getShou()).toBe('青龙');
|
expect(foto.getShou()).toBe('青龙');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('test3()', () => {
|
||||||
|
const foto = Foto.fromLunar(Lunar.fromYmd(2021, 3, 16));
|
||||||
|
expect(foto.getOtherFestivals()).toStrictEqual(['准提菩萨圣诞']);
|
||||||
|
});
|
||||||
|
|||||||
12
__tests__/I18n.test.js
Normal file
12
__tests__/I18n.test.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
const {Lunar, I18n} = require('../lunar');
|
||||||
|
|
||||||
|
test('test1', () => {
|
||||||
|
const lunar = Lunar.fromYmd(2023,1,1);
|
||||||
|
console.log(lunar.toFullString());
|
||||||
|
|
||||||
|
I18n.setLanguage('en');
|
||||||
|
console.log(lunar.toFullString());
|
||||||
|
|
||||||
|
I18n.setLanguage('chs');
|
||||||
|
});
|
||||||
|
|
||||||
37
__tests__/LunarMonth.test.js
Normal file
37
__tests__/LunarMonth.test.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
var {LunarMonth} = require('../lunar');
|
||||||
|
|
||||||
|
test('test1', () => {
|
||||||
|
const month = LunarMonth.fromYm(2023, 1);
|
||||||
|
expect(month.getIndex()).toBe(1);
|
||||||
|
expect(month.getGanZhi()).toBe('甲寅');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('test2', () => {
|
||||||
|
const month = LunarMonth.fromYm(2023, -2);
|
||||||
|
expect(month.getIndex()).toBe(3);
|
||||||
|
expect(month.getGanZhi()).toBe('丙辰');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('test3', () => {
|
||||||
|
const month = LunarMonth.fromYm(2023, 3);
|
||||||
|
expect(month.getIndex()).toBe(4);
|
||||||
|
expect(month.getGanZhi()).toBe('丁巳');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('test4', () => {
|
||||||
|
const month = LunarMonth.fromYm(2024, 1);
|
||||||
|
expect(month.getIndex()).toBe(1);
|
||||||
|
expect(month.getGanZhi()).toBe('丙寅');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('test5', () => {
|
||||||
|
const month = LunarMonth.fromYm(2023, 12);
|
||||||
|
expect(month.getIndex()).toBe(13);
|
||||||
|
expect(month.getGanZhi()).toBe('丙寅');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('test6', () => {
|
||||||
|
const month = LunarMonth.fromYm(2022, 1);
|
||||||
|
expect(month.getIndex()).toBe(1);
|
||||||
|
expect(month.getGanZhi()).toBe('壬寅');
|
||||||
|
});
|
||||||
6
index.js
6
index.js
@@ -1,4 +1,4 @@
|
|||||||
const {Solar, Lunar, Foto, Tao, NineStar, EightChar, SolarWeek, SolarMonth, SolarSeason, SolarHalfYear, SolarYear, LunarMonth, LunarYear, LunarTime, ShouXingUtil, SolarUtil, LunarUtil, FotoUtil, TaoUtil, HolidayUtil} = require('./lunar.js')
|
const {Solar, Lunar, Foto, Tao, NineStar, EightChar, SolarWeek, SolarMonth, SolarSeason, SolarHalfYear, SolarYear, LunarMonth, LunarYear, LunarTime, ShouXingUtil, SolarUtil, LunarUtil, FotoUtil, TaoUtil, HolidayUtil, NineStarUtil, I18n} = require('./lunar.js')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Solar: Solar,
|
Solar: Solar,
|
||||||
@@ -20,5 +20,7 @@ module.exports = {
|
|||||||
LunarUtil: LunarUtil,
|
LunarUtil: LunarUtil,
|
||||||
FotoUtil: FotoUtil,
|
FotoUtil: FotoUtil,
|
||||||
TaoUtil: TaoUtil,
|
TaoUtil: TaoUtil,
|
||||||
HolidayUtil: HolidayUtil
|
HolidayUtil: HolidayUtil,
|
||||||
|
NineStarUtil: NineStarUtil,
|
||||||
|
I18n: I18n
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lunar-javascript",
|
"name": "lunar-javascript",
|
||||||
"version": "1.3.3",
|
"version": "1.6.2",
|
||||||
"description": "lunar is a calendar library for Solar and Chinese Lunar.",
|
"description": "lunar is a calendar library for Solar and Chinese Lunar.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user