Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
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
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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.