1.0.4 • Published 2 years ago

easybookjs-lib v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Easybook JS Library

Getting started

This library was created to share code between API and frontend apps. Library includes:

  • Types
  • Helper functions
  • Libs

Day Scheduler

This utils helps you to work day timeline. You can build timeline add to this timeline schedule or events. You can validate schedule.

Init Day scheduler

You should init day scheduler and pass required data. \ For example: \ const dayScheduler = new DayScheduler(schedule);

Set day of week to work with

const dayScheduleMonday = new DayScheduler(schedule).applyDay('Monday')

Add events for this day to schedule

const dayScheduleMondayWithEvents = dayScheduleMonday.applyEvents(events)

Can add new event to schedule

const canAdd = dayScheduleMondayWithEvents.canAddEvent('10:30', 40); // where 40 is duration of event.

Get free slots for event in schedule

duration - Duration of event in minutes ex. 90 (1h 30m) \ interval - Interval for free slots. It will defect diff in free slots starts \ const freeSlots = dayScheduleMondayWithEvents.getFreeSlots(duration, interval)

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago