Renders a single day in a calendar. The proper rendering of a day depends on the presence of a wrapping Calendar component. This component renders an unstyled
Today, at midnight
Add months to a date, adjusting the date if necessary.
Get the number of days in a month
Computes the total number of grid cells in a grid which is large enough to render a calendar month. Includes cells for days which fall outside the current month but are visible because of weekday offsets.
Computes the total number of grid rows required to display all the days in a calendar month.
Determines if a given date is on the first row of its respective calendar grid as it would be rendered.
Determines if a given date is in the first week of its month
Determines if a given date is on the last row of its respective calendar grid as it would be rendered.
Determines if a given date is in the last week of its month
Determines if a given date is a weekend
Expands a month into a grid of days, filling in days from previous or next month as necessary.
In a calendar grid, the first day of the month may be offset from the first column if it falls on a day which isn't the first of the week. This computes that offset for a given calendar month.
Determines if a given date a
is before the second date b
(exclusive)
Determines if a given date is between two other dates (exclusive)
Determines if two dates are on the same calendar day
Determines if two dates are on the same calendar month in the same calendar year
Computes whether a given range of dates would include a disabled date according to the given getDateEnabled function. This is O(n) in the number of days in the range.
Given an enclosing Calendar context, this returns the date at the given index. If you have a row and column, compute the index as row * 7 + column.
A helper hook which computes a list of 'days' and 'blanks' which will render into a calendar grid. The 'blanks' are null values and represent grid cells which don't have a day in them (like if a month starts on Tuesday, Sunday and Monday will be blank). Other values will be Dates.
Generated using TypeDoc
An all-purpose Calendar primitive which manages day selection and various useful event callbacks. Rendering is up to you; this component doesn't render any days or interactive elements - just a div to help track focus within the component.