tyme4ts
Version:
Tyme是一个非常强大的日历工具库,可以看作 Lunar 的升级版,拥有更优的设计和扩展性,支持公历和农历、星座、干支、生肖、节气、法定假日等。
42 lines (34 loc) • 790 B
text/typescript
import {suite, test} from '@testdeck/mocha';
import {SolarYear} from '../lib';
import {equal} from 'assert';
class SolarYearTest {
test0() {
equal(SolarYear.fromYear(2023).getName(), '2023年');
}
test1() {
equal(SolarYear.fromYear(2023).isLeap(), false);
}
test2() {
equal(SolarYear.fromYear(1500).isLeap(), true);
}
test3() {
equal(SolarYear.fromYear(1700).isLeap(), false);
}
test4() {
equal(SolarYear.fromYear(2023).getDayCount(), 365);
}
test5() {
equal(SolarYear.fromYear(2023).next(5).getName(), '2028年');
}
test6() {
equal(SolarYear.fromYear(2023).next(-5).getName(), '2018年');
}
}