Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
util-holidays
Advanced tools
- 增加支持自定义API
- 完善单元测试
- 增加2021离线数据
- 增加2020离线数据
# 安装
npm i util-holidays
# 或者 yarn add util-holidays
import { getDayInfo, isWorkingDay, isWeekend, isStatutoryHoliday } from 'util-holidays'
// 获取日期信息
getDayInfo('2020-10-01')
// 返回值结构:
{
date: '2020-10-01',
week: '星期四',
type: '国庆节',
dayType: 3,
ps: 'dayType:1-工作日;2-周末;3-法定节假日;4-补休调工日'
}
// 判断是否工作日(含法定调工,如2020年10月10日)
isWorkingDay('2020-10-10')
// 判断是否正常休息的周末(不含法定调工,如2020年10月10日)
isWeekend('2020-10-10')
// 判断是否法定节假日
isStatutoryHoliday('2020-10-01')
// 格式化日期, fmt -> yyyy-MM-dd hh:mm:ss:S
dateFormat: (date: string | number | Date, fmt?: string) => string
// key获取方式为:https://util.beituyun.com/v1/holidays/creatKey?phone=你的手机号
import { config } from 'util-holidays'
config({
onLine: true,
key: 'your key',
})
import { config } from 'util-holidays'
config({
onLine: true,
url: 'your api'
})
// api返回数据格式参考上面api的返回值:其中status代表是0调工还是1调休
{
flag: 1,
data: [{ date: '2021-06-13', type: '端午节', status: 1 }],
message: 'string'
}
FAQs
A Chinese holiday util
The npm package util-holidays receives a total of 6 weekly downloads. As such, util-holidays popularity was classified as not popular.
We found that util-holidays demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.