New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

slot-generator

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slot-generator

Generating time slots between a time range

latest
Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

slot-generator

Generating time slots between a time range

npm version License: MIT

🛠 Tutorials

Install

npm install slot-generator --save

or

yarn add slot-generator

Basic Usage

const generator = require('slot-generator');

let parm = {
      start: '2022-03-12T05:30:00.000Z',
      end: '2022-03-18T07:30:00.000Z',
      step: 1,
      period: 'h',
      daysInWeek: [6, 1, 3],
      gap: 0,
    };
let slots= generator(parm);
console.log(slots);

// output  [
//       '2022-03-12T05:30:00.000Z',
//       '2022-03-12T06:30:00.000Z',
//       '2022-03-14T05:30:00.000Z',
//       '2022-03-14T06:30:00.000Z',
//       '2022-03-16T05:30:00.000Z',
//       '2022-03-16T06:30:00.000Z',
// ];

Object Param

KeyTypeValueDefault
startstring/Date/moment'2022-03-12T05:30:00.000Z'moment()
endstring/Date/moment'2022-03-18T07:30:00.000Z'moment()
stepnumber55
periodstring'm'/'h'/'d''m'
daysInWeekArray[number][6,1,3][1,2,3,4,5,6,7]
gapnumber00

Contributing

Contributions are welcome. Please submit PRs or just file an Issue if you see something broken or in need of improving.

Keywords

datetime

FAQs

Package last updated on 30 Jun 2022

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