DaySpan
A date & schedule library to use for advanced calendars in TypeScript and JS.
Features
- Schedules track how frequent events occur using 20+ properties
- Events can last minutes, hours, days, or weeks
- Events can occur all day, or 1 or more times during the day
- Events can have any day & time included as an event occurrence (they don't need to match the frequency of the schedule)
- Events can be excluded, cancelled, or have metadata (specific event occurrence, all in a given day, week, month, quarter, or year)
- Event occurrences can be moved
- Calendars can represent a span of days, weeks, months, or years
- Easily list the next/previous days that occur on a schedule
- Describe a schedule in a human friendly string
- Export and import schedules and calendars to plain objects for easy saving and loading
- Provides logic to help display intersecting events on a calendar
TypeScript Example
let cal = Calendar.months<string, any>();
cal.addEvent({
data: 'Weekly Meeting',
schedule: {
dayOfWeek: [Weekday.MONDAY],
times: [9],
duration: 30,
durationUnit: 'minutes'
}
});
cal.addEvent({
data: 'Dr. Appointment',
visible: false,
schedule: {
on: Day.build(2018, Month.APRIL, 1)
}
});
cal.addEvent({
id: 'someUserProvidedId',
data: "Mother's Day",
schedule: new Schedule({
weekspanOfMonth: [1],
dayOfWeek: [Weekday.SUNDAY],
month: [Month.MAY]
})
});
cal.days;
cal.next();
cal.select(Day.build(2018, Month.APRIL, 12));
cal.removeEvent('Weekly Meeting');
Calendar.weeks<MyEvent, any>();
Calendar.days<string, any>(3);
Calendar.days<string, any>(3, Day.build(2018, Month.JUNE, 15), 0);
JS Example
You just need to append ds
to the beginning of the classes:
var cal = ds.Calendar.months();
cal.addEvent({
data: 'Weekly Meeting',
schedule: {
dayOfWeek: [ds.Weekday.MONDAY],
times: [9],
duration: 30,
durationUnit: 'minutes'
}
});
cal.addEvent({
data: 'Dr. Appointment',
schedule: new ds.Schedule({
on: ds.Day.build(2018, ds.Month.APRIL, 1)
})
});
Google Calendar Clone Preview
Month View

Week View

Schedule an Event

Custom Schedule

Year View
