Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0dddcf841f | ||
|
|
7a71e07ade |
@@ -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('壬寅');
|
||||||
|
});
|
||||||
5
index.js
5
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, I18n} = require('./lunar.js')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Solar: Solar,
|
Solar: Solar,
|
||||||
@@ -20,5 +20,6 @@ module.exports = {
|
|||||||
LunarUtil: LunarUtil,
|
LunarUtil: LunarUtil,
|
||||||
FotoUtil: FotoUtil,
|
FotoUtil: FotoUtil,
|
||||||
TaoUtil: TaoUtil,
|
TaoUtil: TaoUtil,
|
||||||
HolidayUtil: HolidayUtil
|
HolidayUtil: HolidayUtil,
|
||||||
|
I18n: I18n
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lunar-javascript",
|
"name": "lunar-javascript",
|
||||||
"version": "1.3.3",
|
"version": "1.6.0",
|
||||||
"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