Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
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 0 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.