@chnlib/chinese-holiday
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

@chnlib/chinese-holiday

NPM version NPM downloads

Install

$ npm i @chnlib/chinese-holiday

Desc

支持 ESM 和 CommonJS 语法

支持 Vue、React、Angular等多种框架
支持 Nodejs,Nest、Koa 框架

Usage

import ChineseHoliday from "@chnlib/chinese-holiday";


ChineseHoliday.isWorkday("2024-02-03"); // false,周六
ChineseHoliday.isWorkday("2024-02-04"); // true,调休
ChineseHoliday.isWorkday("2024-02-09"); // true,工作日
ChineseHoliday.isWorkday("2024-02-10"); // false,春节

ChineseHoliday.isHoliday("2024-02-03"); // false,非节假日
ChineseHoliday.isHoliday("2024-02-04"); // false,调休
ChineseHoliday.isHoliday("2024-02-09"); // false,工作日
ChineseHoliday.isHoliday("2024-02-10"); // true,春节

ChineseHoliday.findHolidays("2020-01-01", "2021-01-01"); // 返回开始时间和结束时间范围内的所有节假日
ChineseHoliday.findHolidays("2021-01-01", "2020-01-01"); // error,开始时间必须比结束时间早

Node Require

let ChineseHoliday = require('@chnlib/chinese-holiday').default

ChineseHoliday.isHoliday('2023-01-01')

Node Nestjs

import ChineseHoliday from '@chnlib/chinese-holiday';

ChineseHoliday.isHoliday('2023-01-01')

LICENSE

MIT

Dependencies (1)

Dev Dependencies (1)

Package Sidebar

Install

npm i @chnlib/chinese-holiday

Weekly Downloads

11

Version

1.2.0

License

MIT

Unpacked Size

225 kB

Total Files

119

Last publish

Collaborators

  • chnlib