JSPM

@chnlib/chinese-holiday

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q53236F
  • License MIT

中国节假日

Package Exports

  • @chnlib/chinese-holiday
  • @chnlib/chinese-holiday/dist/cjs/index.js
  • @chnlib/chinese-holiday/dist/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@chnlib/chinese-holiday) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@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