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 🙏

© 2024 – Pkg Stats / Ryan Hefner

timeslotterjs

v0.0.1

Published

Efficiently manage time slots in your JavaScript applications with TimeSlotterJS. Ideal for creating schedules, booking systems, or any scenario where time slot management is key.

Downloads

8

Readme

TimeSlotterJS 🕒✨

TimeSlotterJS: A simple yet powerful tool for effortless time slot management. Perfect for scheduling appointments or organizing your day with ease!

Installation

npm install timeslotterjs

Usage

TimeSlotterJS is as intuitive as it gets. Here's how to use it:

import { createSchedule, IncrementUnit } from "timeslotterjs";

// Planning a simple day
const dailySchedule = createSchedule({
  start: new Date("2024-01-01T08:00:00"),
  end: new Date("2024-01-01T17:00:00"),
  increment: 1,
  incrementUnit: IncrementUnit.Hours,
});

console.log("Available Time Slots:", dailySchedule);

// OUTPUT:
// [
//   { "startTime": "2024-01-01T08:00:00.000Z", "endTime": "2024-01-01T09:00:00.000Z", "isBooked": false },
//   { "startTime": "2024-01-01T09:00:00.000Z", "endTime": "2024-01-01T10:00:00.000Z", "isBooked": false },
//   // More time slots...
// ]

Options Overview

Here's a breakdown of the options you can use with TimeSlotterJS:

| Option | Type | Description | | --------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------- | | start | Date | The start time of your schedule. | | end | Date | The end time of your schedule. | | increment | number | The duration of each time slot. | | incrementUnit | IncrementUnit (enum) | The unit for the increment (Hours, Minutes, Seconds). | | bookings | Array<Interval> (optional) | An array of existing bookings/appointments. Each booking is an object with startTime and endTime (both Date types). | | maxBookings | number (optional) | The maximum number of bookings allowed per slot (defaults to 1). |

Output

Here's what a typical output looks like:

| Property | Type | Description | | ----------- | --------- | -------------------------------- | | startTime | Date | Start time of the time slot. | | endTime | Date | End time of the time slot. | | isBooked | boolean | Whether the time slot is booked. |

More Examples

Handling Appointments

import { createSchedule, IncrementUnit } from "timeslotterjs";

const appointments = [
  { startTime: new Date("2024-01-01T09:00:00"), endTime: new Date("2024-01-01T10:00:00") },
  // More appointments here...
];

// Schedule with existing appointments
const mySchedule = createSchedule({
  start: new Date("2024-01-01T08:00:00"),
  end: new Date("2024-01-01T17:00:00"),
  increment: 1,
  incrementUnit: IncrementUnit.Hours,
  bookings: appointments, // Your pre-booked appointments
});

console.log("My Scheduled Day:", mySchedule);

Customizing Maximum Bookings

import { createSchedule, IncrementUnit } from "timeslotterjs";

// A busy day scenario
const busyDay = createSchedule({
  // ...your start, end, increment settings
  maxBookings: 3, // Allowing up to 3 bookings per slot
});

console.log("My Busy Day Schedule:", busyDay);

Contributing

Got a cool idea to enhance TimeSlotterJS? Fork, branch, and pull request to contribute!

License

TimeSlotterJS is released under the MIT License. Feel free to use and modify it as you like.


Here's to making bookings, appointments, and time management fun and efficient! 🎉⏱️