UNPKG

chinese-days

Version:

中国节假日、调休日、工作日、24节气查询,农历阳历互转,支持 TS、CommonJS、UMD 模块化使用,提供 ics 日历格式,可供 Google Calendar、Apple Calendar、Microsoft Outlook 等客户端订阅。

15 lines (11 loc) 467 B
import dayjs, { type Dayjs, type ConfigType } from "../utils/dayjs"; // wrapDate to the start of the day export const wrapDate = (date: ConfigType): Dayjs => { return dayjs(date).startOf("day"); }; export const getDates = (start: ConfigType, end: ConfigType): Dayjs[] => { start = wrapDate(start); end = wrapDate(end); const deltaDays = end.diff(start, 'day'); return Array.from({ length: deltaDays + 1 }, (_, i) => start.add(i, 'day')); }