1
0
mirror of synced 2026-04-16 21:38:40 +08:00

Compare commits

...

2 Commits

Author SHA1 Message Date
6tail
0dddcf841f v1.6.0 多语言支持。 2023-04-16 18:30:42 +08:00
6tail
7a71e07ade v1.3.4 LunarMonth增加序号、干支、财神方位等;完善纪念日。 2023-03-26 21:56:49 +08:00
6 changed files with 2390 additions and 333 deletions

View File

@@ -13,3 +13,8 @@ test('test2()', () => {
expect(foto.getGong()).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
View 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');
});

View 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('壬寅');
});

View File

@@ -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 = {
Solar: Solar,
@@ -20,5 +20,6 @@ module.exports = {
LunarUtil: LunarUtil,
FotoUtil: FotoUtil,
TaoUtil: TaoUtil,
HolidayUtil: HolidayUtil
HolidayUtil: HolidayUtil,
I18n: I18n
}

2662
lunar.js

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "lunar-javascript",
"version": "1.3.3",
"version": "1.6.0",
"description": "lunar is a calendar library for Solar and Chinese Lunar.",
"main": "index.js",
"scripts": {