npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@varyans/schedule-domain

v1.0.5

Published

## Description

Readme

Typescript Schedule Domain

Description

You could use this package to easily solve schedule required systems.

It doesn't matter witch date you are passing to check. Week time represented as units from 0 to 10080. One day 24 hours is equal to 1440 units

  • Add as many schedules as required per day
  • Add start in day 1 and close on next day(s)
  • Office, Restaurant open/closed for given time
  • Schools is there a date intersection for classrooms

Installation

npm i @varyans/schedule-domain

Examples

Note. make sure the timezone is correct (node, database) before using it.

Create schedules

import { scheduleServiceFactory } from '@varyans/schedule-domain';

const scheduleService = scheduleServiceFactory();

scheduleService.bulkCreate(
  {
    day: 0, // Sunday
    end: '21:30',
    start: '09:30',
  },
  {
    day: 1, // Monday
    end: '21:30',
    start: '09:30',
  },
  {
    day: 2, // Tuesday
    end: '21:30',
    start: '09:30',
  },
  {
    day: 3, // Wednesday
    end: '21:30',
    start: '09:30',
  },
  {
    day: 4, // Thursday
    end: '21:30',
    start: '09:30',
  },
  {
    day: 5, // Friday
    end: '21:30',
    start: '09:30',
  },
  {
    day: 6, // Saturday
    end: '21:30',
    start: '09:30',
  }
).then(r => {});

Check is there a date range containing given date


import { scheduleServiceFactory } from '@varyans/schedule-domain';

const scheduleService = scheduleServiceFactory();

scheduleService.hasRangeContainingDate(new Date('2021-01-03 21:29')).then(r => {
  console.log(r === true ? 'Date in range' : 'No range containing diven date');
});

Check is there a date range intersection


import { scheduleServiceFactory } from '@varyans/schedule-domain';

const scheduleService = scheduleServiceFactory();

scheduleService.hasIntersection(new Date('2021-01-03 14:29'), new Date('2021-01-03 16:10')).then(r => {
  console.log(r === true ? 'Has intersection' : 'No intersections');
});

Add new repository providers

  • Create .env file if not exists
  • Add SCHEDULE_CONFIG_PATH=path-to-your-config-file
  • Copy content from package config file
  • Add new database provider mongo, mysql or something else
  • Create repository object for that provider
  • Add factory path for provider repository in config file
  • Use provider name when creating instance of schedule service

Tests

All packages functionality test is covered by jest

Supported repositories

  • Array
  • Postgres
    • Postgres repository will automatically create a table with name specified in your custom config or with default "schedules" name.

License

MIT

Author

Varazdat Stepanyan