Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dayspan

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dayspan

A date & schedule library to use for advanced calendars in TypeScript and JS

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3K
increased by15.18%
Maintainers
1
Weekly downloads
 
Created
Source

DaySpan

A date & schedule library to use for advanced calendars in TypeScript and JS.

  • Google Calendar Clone
  • Documentation
  • Download JS
  • Install via bower install dayspan or npm install dayspan

TypeScript Example

// A monthly calendar around today
let cal = Calendar.months<string>();

// Every Monday 9:00 - 9:30
cal.addSchedule({
  event: 'Weekly Meeting',
  schedule: new Schedule({
    dayOfWeek: [Weekday.MONDAY],
    times: [9],
    duration: 30,
    durationUnit: 'minutes'
  })
});

// Dr. Appointment on 01/04/2018
cal.addSchedule({
  event: 'Dr. Appointment',
  schedule: new Schedule({
    on: Day.build(2018, Month.APRIL, 1)
  })
});

// Mother's Day
cal.addSchedule({
  event: "Mother's Day",
  schedule: new Schedule({
    weekspanOfMonth: [1],         // 2nd
    dayOfWeek: [Weekday.SUNDAY],  // Sunday
    month: [Month.MAY]            // of May
  })
});

// The array of days in the month, each day has a list of the days events.
cal.days;

// Go to the next month
cal.next();

// Select this day and update the selection flags in the calendar days
cal.select(Day.build(2018, Month.APRIL, 12));

// Remove the schedule
cal.removeSchedule('Weekly Meeting');

// A weekly calendar with custom MyEvent class
Calendar.weeks<MyEvent>();

// A daily calendar covering 3 days centered on today
Calendar.days<string>(3);

// A daily calendar covering 3 days starting with given date
Calendar.days<string>(3, Day.build(2018, Month.JUNE, 15), 0);

JS Example

You just need to append ds to the beginning of the classes:

// A monthly calendar around today
var cal = ds.Calendar.months();

// Every Monday 9:00 - 9:30
cal.addSchedule({
  event: 'Weekly Meeting',
  schedule: new ds.Schedule({
    dayOfWeek: [ds.Weekday.MONDAY],
    times: [9],
    duration: 30,
    durationUnit: 'minutes'
  })
});

// Dr. Appointment on 01/04/2018
cal.addSchedule({
  event: 'Dr. Appointment',
  schedule: new ds.Schedule({
    on: ds.Day.build(2018, ds.Month.APRIL, 1)
  })
});

Google Calendar Clone Preview

Month View

Month

Week View

Week

Schedule an Event

Scheduler

Custom Schedule

Custom

Year View

Year

FAQs

Package last updated on 31 May 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc