Skip to content

Commit dae99b4

Browse files
committed
Update documentation for compatibility with React-Calendar v2.4.0
1 parent 8835aa5 commit dae99b4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,12 @@ Displays an input field complete with custom inputs, native input, and a calenda
107107
|onClickDecade|Function called when the user clicks a decade on a calendar.|`(value) => alert('Clicked decade: ', value)`|
108108
|onClickMonth|Function called when the user clicks a month on a calendar.|`(value) => alert('Clicked month: ', value)`|
109109
|onClickYear|Function called when the user clicks a year on a calendar.|`(value) => alert('Clicked year: ', value)`|
110-
|prevLabel|Defines the content of the "previous" button on the navigation pane. Defaults to "‹".|<ul><li>String: `"‹"`</li><li>React element: `<PrevousIcon />`</li></ul>|
110+
|prevLabel|Defines the content of the "previous" button on the navigation pane. Defaults to "‹".|<ul><li>String: `"‹"`</li><li>React element: `<PreviousIcon />`</li></ul>|
111111
|prev2Label|Defines the content of the "previous on higher level" button on the navigation pane. Defaults to "«".|<ul><li>String: `"«"`</li><li>React element: `<DoublePreviousIcon />`</li></ul>|
112-
|renderChildren|Allows to render custom content within a given calendar item (day on month view, month on year view and so on).|`({ date, view }) => view === 'month' && date.getDay() === 0 ? <p>It's Sunday!</p> : null`|
113112
|returnValue|Defines which dates shall be passed by the calendar to the onChange function and onClick{Period} functions. Can be "start", "end" or "range". The latter will cause an array with start and end values to be passed. Defaults to "start".|`"range"`|
114113
|showNeighboringMonth|Defines whether days from previous or next month shall be rendered if the month doesn't start on the first day of the week or doesn't end on the last day of the week, respectively. Defaults to true.|`false`|
114+
|tileClassName|Defines class name(s) that will be applied to a given calendar item (day on month view, month on year view and so on).|<ul><li>String: `"class1 class2"`</li><li>Array of strings: `["class1", "class2 class3"]`</li><li>Function: `({ date, view }) => view === 'month' && date.getDay() === 3 ? 'saturday' : null`</li></ul>|
115+
|tileContent|Allows to render custom content within a given calendar item (day on month view, month on year view and so on).|<ul><li>String: `"Sample"`</li><li>React element: `<TileContent />`</li><li>Function: `({ date, view }) => view === 'month' && date.getDay() === 0 ? <p>It's Sunday!</p> : null`</li></ul>|
115116
|showWeekNumbers|Defines whether week numbers shall be shown at the left of MonthView or not. Defaults to false.|`true`|
116117
|value|Defines the value of the input.|<ul><li>Date: `new Date()`</li><li>An array of dates: `[new Date(2017, 0, 1), new Date(2017, 7, 1)]`|
117118
|view|Determines which calendar view shall be opened initially. Does not disable navigation. Can be "month", "year", "decade" or "century". Defaults to the most detailed view allowed.|`"year"`|

index.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ declare module "react-date-picker" {
2525
onClickYear?: DateCallback;
2626
prev2Label?: string | React.ReactElement<any>;
2727
prevLabel?: string | React.ReactElement<any>;
28-
renderChildren?: (props: DatePickerRenderChildrenProps) => JSX.Element | null;
28+
renderChildren?: (props: CalendarTileProperties) => JSX.Element | null;
2929
returnValue?: "start" | "end";
30+
tileClassName?: string | string[] | ((props: CalendarTileProperties) => string | string[] | null);
31+
tileContent?: React.ReactElement<any> | ((props: CalendarTileProperties) => JSX.Element | null);
3032
showNeighboringMonth?: boolean;
3133
showWeekNumbers?: boolean;
3234
value?: Date;
3335
view?: Detail;
3436
}
3537

36-
export interface DatePickerRenderChildrenProps {
38+
export interface CalendarTileProperties {
3739
date: Date;
3840
view: Detail;
3941
}

0 commit comments

Comments
 (0)