1.0.8 • Published 3 years ago

availability-lib v1.0.8

Weekly downloads
3
License
ISC
Repository
github
Last release
3 years ago

Availability lib

Introduction

This package is use for:

  • Cheking the given time is available or not with configured availability slots.
  • Find the next available time with the given time

APIs

Initiate a availability service

import { AvailabilityService } from "availability-lib";

const service = new AvailabilityService(from, to);

// from, to is moment instance

Add an unavailable event

import { AvailabilityService, Interval } from "availability-lib";

const service = new AvailabilityService(from, to);
service.setUnAvailability(from, to, Interval.ONCE);

// from, to: moment instance
// Interval: Enum {"ONCE", "DAILY", "WEEKLY", "MONTHLY", "YEARLY" }

NOTE: Currently, from and to should be in the same date. Will make improvement to set in difference day

Check if the given time is available or not

import { AvailabilityService, Interval } from "availability-lib";

const service = new AvailabilityService(from, to);
const result = service.isAvailable(from, to);

// from, to: moment instance
// result: boolean

Check if when is the next available with the given time

import { AvailabilityService, Interval } from "availability-lib";

const service = new AvailabilityService(from, to);
const result = service.getNextAvailability(time);

// time: moment instance
// result: Moment instance
1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago