Skip to content
Source
Sign inSign up
TanStack/time

[RFC] feat(react-time): useCalendar hook #7

Closedbart-krakowski(GitHub profile, opens in a new tab)wants to merge 61 commits intov0 fromrefs/pull/7/headopened

Showing 25 changed files with 230 additions and 0 deletions (loading 23).

x
0 of 25 viewed, 25 left
230 additions and 0 deletionsdocs/framework/react/reference/useCalendar.mdAdded
View file
@@ -0,0 +1,230 @@
+---
+title: Use Calendar
+id: useCalendar
+---
+​
+### `useCalendar`
+​
+```tsx
+export function useCalendar({
+ weekStartsOn,
+ events,
+ viewMode,
+ locale,
+ onChangeViewMode,
+}: UseCalendarProps)
+```
+​
+`useCalendar` is a hook that provides a comprehensive set of functionalities for managing calendar events, view modes, and period navigation.
+​
+​
+#### Parameters
+​
+- `weekStartsOn?: number`
+ - This parameter is an optional number that specifies the day of the week that the calendar should start on. It defaults to 0, which is Sunday.
+- `events: Event[]`
+ - This parameter is an array of events that the calendar should display.
+- `viewMode: 'month' | 'week' | number`
+ - This parameter is a string that specifies the initial view mode of the calendar. It can be either 'month', 'week', or a number representing the number of days in a custom view mode.
+- `locale?: string`
+ - This parameter is an optional string that specifies the locale to use for formatting dates and times. It defaults to the system locale.