Skip to content

Commit

Permalink
set showDatesOutsideMonth={false} in DatePicker examples (#2265)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank99 authored Sep 26, 2024
1 parent 722b4dd commit ff8f9d2
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 48 deletions.
2 changes: 2 additions & 0 deletions apps/website/src/content/docs/datepicker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ This component is recommended to be used inside the [`Popover`](popover) compone

If you would rather see an example of the date picker being used on its own, look at the [standalone usage](#standalone-usage).

**Note**: The `showDatesOutsideMonth` prop is recommended to be set to `false`, so that dates that are not in the currently selected month are not displayed. Currently, this prop defaults to `true` for backwards compatibility reasons.

### Localized

You are able to create a localized version of the date picker that uses local names for week days and months.
Expand Down
8 changes: 2 additions & 6 deletions examples/DatePicker.basic.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@ export default () => {
setVisible(false);
}}
setFocus
showDatesOutsideMonth={false}
/>
}
placement='bottom-start'
visible={visible}
onVisibleChange={setVisible}
>
<IconButton
label='Choose date'
onClick={() => {
setVisible(!visible);
}}
>
<IconButton label='Choose date'>
<SvgCalendar />
</IconButton>
</Popover>
Expand Down
8 changes: 2 additions & 6 deletions examples/DatePicker.daterange.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ export default () => {
setVisible(false);
}}
setFocus
showDatesOutsideMonth={false}
/>
}
placement='bottom-start'
visible={visible}
onVisibleChange={setVisible}
>
<IconButton
label='Choose date'
onClick={() => {
setVisible(!visible);
}}
>
<IconButton label='Choose date'>
<SvgCalendar />
</IconButton>
</Popover>
Expand Down
8 changes: 2 additions & 6 deletions examples/DatePicker.datesdisabled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,14 @@ export default () => {
setVisible(false);
}}
setFocus
showDatesOutsideMonth={false}
/>
}
placement='bottom-start'
visible={visible}
onVisibleChange={setVisible}
>
<IconButton
label='Choose date'
onClick={() => {
setVisible(!visible);
}}
>
<IconButton label='Choose date'>
<SvgCalendar />
</IconButton>
</Popover>
Expand Down
8 changes: 2 additions & 6 deletions examples/DatePicker.localized.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@ export default () => {
setVisible(false);
}}
setFocus
showDatesOutsideMonth={false}
/>
}
placement='bottom-start'
visible={visible}
onVisibleChange={setVisible}
>
<IconButton
label='Choose date'
onClick={() => {
setVisible(!visible);
}}
>
<IconButton label='Choose date'>
<SvgCalendar />
</IconButton>
</Popover>
Expand Down
8 changes: 2 additions & 6 deletions examples/DatePicker.main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@ export default () => {
setVisible(false);
}}
setFocus
showDatesOutsideMonth={false}
/>
}
placement='bottom-start'
visible={visible}
onVisibleChange={setVisible}
>
<IconButton
label='Choose date'
onClick={() => {
setVisible(!visible);
}}
>
<IconButton label='Choose date'>
<SvgCalendar />
</IconButton>
</Popover>
Expand Down
1 change: 1 addition & 0 deletions examples/DatePicker.menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default () => {
setCurrentDate(date);
}}
applyBackground={false}
showDatesOutsideMonth={false}
/>
<div className='demo-label'>{currentDate.toDateString()}</div>
</Wrapper>
Expand Down
8 changes: 2 additions & 6 deletions examples/DatePicker.withcombinedtime.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@ export default () => {
minuteStep={30}
use12Hours={true}
setFocus
showDatesOutsideMonth={false}
/>
}
placement='bottom-start'
visible={visible}
onVisibleChange={setVisible}
>
<IconButton
label='Choose date'
onClick={() => {
setVisible(!visible);
}}
>
<IconButton label='Choose date'>
<SvgCalendar />
</IconButton>
</Popover>
Expand Down
8 changes: 2 additions & 6 deletions examples/DatePicker.withtime.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@ export default () => {
}}
showTime={true}
setFocus
showDatesOutsideMonth={false}
/>
}
placement='bottom-start'
visible={visible}
onVisibleChange={setVisible}
>
<IconButton
label='Choose date'
onClick={() => {
setVisible(!visible);
}}
>
<IconButton label='Choose date'>
<SvgCalendar />
</IconButton>
</Popover>
Expand Down
8 changes: 2 additions & 6 deletions examples/DatePicker.withyear.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@ export default () => {
setVisible(false);
}}
setFocus
showDatesOutsideMonth={false}
/>
}
placement='bottom-start'
visible={visible}
onVisibleChange={setVisible}
>
<IconButton
label='Choose date'
onClick={() => {
setVisible(!visible);
}}
>
<IconButton label='Choose date'>
<SvgCalendar />
</IconButton>
</Popover>
Expand Down

0 comments on commit ff8f9d2

Please sign in to comment.