From f62cceed11e699736eb1d5ba2afbd4f6f579b5ad Mon Sep 17 00:00:00 2001 From: Lennert Claeys Date: Mon, 19 Dec 2022 11:42:33 +0100 Subject: [PATCH 1/3] Allow changing the initial month if no date is selected --- src/components/datepicker/DatePicker.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/datepicker/DatePicker.tsx b/src/components/datepicker/DatePicker.tsx index 019533eb6..000f1de01 100644 --- a/src/components/datepicker/DatePicker.tsx +++ b/src/components/datepicker/DatePicker.tsx @@ -26,8 +26,12 @@ export interface DatePickerProps extends Omit; + /** Show a dropdown for the month? */ withMonthPicker?: boolean; + /** Show week numbers? */ showWeekNumbers?: boolean; + /** The initial month to display if no date is selected. */ + initialMonth?: Date; } const DatePicker: GenericComponent = ({ @@ -37,6 +41,7 @@ const DatePicker: GenericComponent = ({ size = 'medium', withMonthPicker, showWeekNumbers, + initialMonth, onChange, ...others }) => { @@ -89,7 +94,7 @@ const DatePicker: GenericComponent = ({ Date: Mon, 19 Dec 2022 11:42:43 +0100 Subject: [PATCH 2/3] Update storybook --- src/components/datepicker/datePicker.stories.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/datepicker/datePicker.stories.tsx b/src/components/datepicker/datePicker.stories.tsx index d047c27b1..fd1e52077 100644 --- a/src/components/datepicker/datePicker.stories.tsx +++ b/src/components/datepicker/datePicker.stories.tsx @@ -31,6 +31,7 @@ singleDate.args = { size: 'medium', withMonthPicker: true, showWeekNumbers: false, + initialMonth: new Date(), }; singleDate.parameters = { design: [ From 1f25c0e50e87dcc293a7ac4147a6676b5d9fcdb8 Mon Sep 17 00:00:00 2001 From: Lennert Claeys Date: Mon, 19 Dec 2022 11:52:16 +0100 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c88ed707..1fd1af09a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,11 @@ ### Dependency updates -## [18.2.3] - 2022-12-16 +## [18.3.0] - 2022-12-19 + +### Added + +- `DatePicker`: Allow changing the initialMonth if no date is selected ([@lorgan3](https://github.com/lorgan3)) in ([#2498](https://github.com/teamleadercrm/ui/pull/2498)) ### Fixed