Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
dayspan
Advanced tools
Readme
A date & schedule library to use for advanced calendars in TypeScript and JS.
bower install dayspan
or npm install dayspan
// A monthly calendar around today (string=event data type, any=schedule metadata type)
let cal = Calendar.months<string, any>();
// Every Monday 9:00 - 9:30
cal.addEvent({
data: 'Weekly Meeting',
schedule: {
dayOfWeek: [Weekday.MONDAY],
times: [9],
duration: 30,
durationUnit: 'minutes'
}
});
// Dr. Appointment on 01/04/2018
cal.addEvent({
data: 'Dr. Appointment',
visible: false,
schedule: {
on: Day.build(2018, Month.APRIL, 1)
}
});
// Mother's Day
cal.addEvent({
id: 'someUserProvidedId',
data: "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.removeEvent('Weekly Meeting');
// A weekly calendar with custom MyEvent class
Calendar.weeks<MyEvent, any>();
// A daily calendar covering 3 days centered on today
Calendar.days<string, any>(3);
// A daily calendar covering 3 days starting with given date
Calendar.days<string, any>(3, Day.build(2018, Month.JUNE, 15), 0);
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.addEvent({
data: 'Weekly Meeting',
schedule: {
dayOfWeek: [ds.Weekday.MONDAY],
times: [9],
duration: 30,
durationUnit: 'minutes'
}
});
// Dr. Appointment on 01/04/2018
cal.addEvent({
data: 'Dr. Appointment',
schedule: new ds.Schedule({
on: ds.Day.build(2018, ds.Month.APRIL, 1)
})
});
FAQs
A date & schedule library to use for advanced calendars in TypeScript and JS
The npm package dayspan receives a total of 1,542 weekly downloads. As such, dayspan popularity was classified as popular.
We found that dayspan demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.