New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cn-workday

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cn-workday

china workday

  • 1.0.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by14.29%
Maintainers
0
Weekly downloads
 
Created
Source

cn-workday

获取中国工作日情况

Installation


    $ npm install cn-workday

Or

    $ yarn add cn-workday

Usage

    import { isWorkday, getWorkdays, getWorkdaysBetween } from 'cn-workday';
    
    isWorkday(); // 返回今天是否是工作日
    isWorkday('2022-10-08'); // true
    isWorkday(new Date('2022-10-08')); // true

    getWorkdays(); // 返回本周的工作日数组
    getWorkdays('2022-10-08'); // 返回 2022-10-08 所在周的工作日数组
    getWorkdays('2022-10-08', 'Month'); // 返回 2022-10-08 所在月份的工作日数组
    getWorkdaysBetween('2022-10-01', '2022-10-31'); // 返回2022-10-01与2022-10-31之间的工作日数组

node使用

    const { isWorkday, getWorkdays, getWorkdaysBetween } = require('cn-workday');
    
    isWorkday(); // 返回今天是否是工作日
    getWorkdays(); // 返回本周的工作日数组
    getWorkdaysBetween('2022-10-01', '2022-10-31'); // 返回2022-10-01与2022-10-31之间的工作日数组

Api

isWorkday

判断一个日期是否为工作日

  • param: date string | Date 日期
  • return: Boolean

getWorkDays

获取一个日期所在周|月的工作日数组

  • param1: date string | Date | 'Week' | 'Month'
  • param2: 'Week' | 'Month'
  • return: Array [{ d: Date, dateStr: dateString, type: number }] type: 1(工作日)/2(周末补班)/3(周末)/4(节假日)

getWorkdaysBetween

获取两个日期之间的工作日数组

  • param1: date string
  • param2: date string
  • return: [{ d: Date, dateStr: dateString, type: number }] type: 1(工作日)/2(周末补班)/3(周末)/4(节假日)

LICENSE


MIT

Keywords

FAQs

Package last updated on 13 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc