
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
calendar-builder
Advanced tools
Provides all logic you need for building a calendar or datetime-picker.
All the logic you need to quickly build a custom calendar or date-picker for any framework or plain vanilla JavaScript.
Feature | Example |
---|---|
Plain | ![]() |
First day of week | ![]() |
Selection: single | ![]() |
Selection: range | ![]() |
After | ![]() |
Before | ![]() |
Disable days of week | ![]() |
Disable specific days | ![]() |
const options = {
firstDay: 1 // Monday
}
let calendar = create(Date.now(), options)
const nextMonth = () => {
calendar = create(calendar.next, options)
}
const prevMonth = () => {
calendar = create(calendar.prev, options)
}
Sample output from calling create()
Note that the
month
in CalendarDate
is 1-based and that,day
is what is called 'date' in the Date APi.type CalendarDate =
| { year: number; month: number; day?: number }
| string
| number
| Date;
interface CalendarEvent<T = any> {
label: string,
date: Date
value?: T
}
type CalendarBuilderOptions = {
/**
* The first day of the week
*
* Default: 0
*/
firstDay: number;
/**
* Add a fill week to the end even if not needed. This is useful to avoid
* "flicker" when some months are 4-6 weeks only.
*
* Default: true
*/
fillWeek: boolean;
/**
* Mark dates before this time invalid (excluding)
*
* E.g. after = 2021-05-29, then first valid date is 2021-05-30.
*/
after: CalendarDate;
/**
* Mark dates after this time invalid (excluding)
*
* E.g. before = 2021-05-29, then last valid date is 2021-05-28.
*/
before: CalendarDate;
/**
* Mark days in this range as selected. The selection state of the day may
* vary if it is the first, last, middle, or only day in the selection.
*/
selection: [CalendarDate, CalendarDate];
/**
* Optionally pas in date for when is 'now'.
*/
now: CalendarDate;
/**
* Disable days of the week
*/
disableDaysOfWeek: number[];
/**
* Disable specific days
*/
disableDays: CalendarDate[];
/**
* Events to "bucket". Will distribute an array of events into the
event-bucket on each of the calendar days.
*/
events: CalendarEvent[];
};
FAQs
Provides all logic you need for building a calendar or datetime-picker.
The npm package calendar-builder receives a total of 3 weekly downloads. As such, calendar-builder popularity was classified as not popular.
We found that calendar-builder 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.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.