diff --git a/docs/components/datetime-picker.md b/docs/components/datetime-picker.md index dba2af5593..af82ad052e 100644 --- a/docs/components/datetime-picker.md +++ b/docs/components/datetime-picker.md @@ -6,13 +6,13 @@ ### Single date -Create a single date selection calendar, with an example of passing in a fixed pixel width for the input field, and an empty string for `currentValue` which defaults the input to the placeholder message. +Create a single date selection calendar, with an example of passing in a fixed pixel width for the input field, and null values for the `start` and `end` keys, which causes the input to display the placeholder message. -Set the `v-model` to [Single date time picker](#single-date-time-picker-v-model) +Set the `v-model` to [Single date time picker](#single-date-time-picker-v-model). Mode is set to `date`, which results in a calendar, but no timepicker.
-
Emitted value:
{{ JSON.stringify(currentValue0) }}
+
Emitted value:
{{ singleDateEmpty }}
```html ``` ### Single date and time -Set the `v-model` to [Single date time picker](#single-date-time-picker-v-model) +Setting the `v-model` to [Single date time picker](#single-date-time-picker-v-model) with a `start` value of `new Date()` will initialize the datepicker with today's date. Mode is set to `dateTime`, which results in a calendar, and a timepicker.
-
Emitted value:
{{ JSON.stringify(currentValue1) }}
+
Emitted value:
{{ singleDateToday }}
```html @@ -59,25 +58,24 @@ Set the `v-model` to [Single date time picker](#single-date-time-picker-v-model) clear-button placeholder="Please select a date and time" mode="dateTime" - :minute-increment="5" :range="false" /> ``` ### Date range -Set the `v-model` to [Range date time picker](#range-date-time-picker-v-model) +Set the `v-model` to [Range date time picker](#range-date-time-picker-v-model).
-
Emitted value:
{{ currentValue2 }}
+
Emitted value:
{{ dateRangeWeek }}
```html @@ -97,15 +95,14 @@ Set the `v-model` to [Range date time picker](#range-date-time-picker-v-model)
-
Emitted value:
{{ currentValue3 }}
+
Emitted value:
{{ dateRangeWeek }}
```html @@ -115,7 +112,6 @@ Set the `v-model` to [Range date time picker](#range-date-time-picker-v-model) clear-button placeholder="Please select a date and time" mode="dateTime" - :minute-increment="5" :range="true" /> ``` @@ -124,23 +120,23 @@ Set the `v-model` to [Range date time picker](#range-date-time-picker-v-model) Set the `v-model` to [Range date time picker](#range-date-time-picker-v-model) -Display both a calendar and relative time frames, passing in a preset week-long range. Hide the time. -This instance also makes use of the `minDate` and `maxDate` parameters, which are both optional. +Display both a calendar and relative time frames, passing in a preset week-long range. The `mode` is set to `relativeDate`, which only shows monthly calendar. + +This instance makes use of the optional `minDate` and `maxDate` parameters.
-
Emitted value:
{{ currentValue4 }}
+
Emitted value:
{{ dateRangeWeek }}
```html @@ -152,7 +148,6 @@ This instance also makes use of the `minDate` and `maxDate` parameters, which ar width="415" :min-date="minDate" :max-date="maxDate" - :minute-increment="5" :range="true" :time-periods="[ { @@ -186,23 +181,23 @@ This instance also makes use of the `minDate` and `maxDate` parameters, which ar Set the `v-model` to [Range date time picker](#range-date-time-picker-v-model) -Display both a calendar and relative time frames, passing in a preset week-long range. -This instance also makes use of the `minDate` and `maxDate` parameters, which are both optional. +Display both a calendar and relative time frames, passing in a preset week-long range. This instance makes use of the optional `minDate` and `maxDate` parameters. + +Passing in a `timePeriodsKey` causes the instance to default to the "Relative" tab.
-
Emitted value:
{{ currentValue5 }}
+
Emitted value:
{{ dateRangeWeekRelative }}
```html @@ -214,7 +209,6 @@ This instance also makes use of the `minDate` and `maxDate` parameters, which ar width="415" :min-date="minDate" :max-date="maxDate" - :minute-increment="5" :range="true" :time-periods="[ { @@ -244,16 +238,16 @@ This instance also makes use of the `minDate` and `maxDate` parameters, which ar /> ``` -### Relative date and time +### Relative date and time only -Set the `v-model` to [Range date time picker](#range-date-time-picker-v-model) -This utilizes the same time frames as the previous example; however, in this example we are passing in a pre-selected time frame. +Set the `v-model` to [Range date time picker](#range-date-time-picker-v-model). +This utilizes the same time frames as the previous example; however, in this case we are passing in a pre-selected time frame of one hour, and.
-
Emitted value:
{{ currentValue6 }}
+
Emitted value:
{{ oneHourRelativeOnly }}
```html @@ -308,13 +302,13 @@ This utilizes the same time frames as the previous example; however, in this exa #### Single date time picker `v-model` -A single date or time picker instance which can be seeded with a value as shown here, where `currentValue` is a valid Date object, eg: `new Date()` or an empty string, eg: `''` which will display the placeholder message. +A single date or time picker instance which can be seeded with a value as shown here, where `currentValue`'s `start` key contains a valid Date object, `new Date()` or a `null` value. If null, the picker will display the placeholder message and allow the user to make a selection. ```ts - +currentValue = { + start: new Date(), + end: null, +}, ``` #### Range date time picker `v-model` @@ -325,8 +319,8 @@ Can be seeded with a **relative time frame** by setting the `v-model` to `curren ```ts currentValue = { - start: '', - end: '', + start: null, + end: null, timePeriodsKey: TimeframeKeys.ONE_DAY }, ``` @@ -365,12 +359,6 @@ A valid `Date` object (eg: `Mon Aug 15 2022 08:00:00 GMT-0700 (Pacific Daylight A valid `Date` object (eg: `Fri Aug 19 2022 12:00:00 GMT-0700 (Pacific Daylight Time)`) which blocks out days/times that occur **after** the given timestamp. `maxDate` gets passed down to the calendar component, and does not apply to relative time frames. -**default**: `null` - -### minuteIncrement - -A `Number` which sets the custom interval for the Minutes select dropdown. - **default**: `5` ### mode @@ -391,7 +379,7 @@ Required `String` prop which accepts the following values: ### range -`Boolean` which determines whether the calendar allows selection of a **single** date or time, as opposed to a **range** of start and end values. +`Boolean` which determines whether the calendar allows selection of a **single** date or time, as opposed to a **range** of start and end values. Choosing any relative `mode` option will default the `range` to `true`. **default**: `false` @@ -434,16 +422,20 @@ An array of time frame values to be displayed as buttons in the "Relative" secti ## Events -The events below will fire whenever **Apply** is clicked (assuming the user has made a custom calendar or relative timeframe selection). If **Clear** is clicked, the object shape remains the same, but the values are empty strings. +The events below will fire whenever **Apply** is clicked (assuming the user has made a custom calendar or relative timeframe selection). If **Clear** is clicked, the object shape remains the same, but the `start` and `end` values will be `null`. ### Single date time picker **Events**: `change`, `update:modelValue` -Will emit a JavaScript Date object, or an empty string "Clear". +Component will emit a JavaScript Date object for the `start` value, and a null value for `end`. +When "Clear" is clicked, it will emit null values for both `start` and `end`. ```ts -"2022-09-06T19:45:54.406Z" // ISO 8601 Date string +{ + start: "2022-09-06T19:45:54.406Z", + end: null, +}, ``` ### Range date time picker @@ -457,7 +449,7 @@ Will emit an `object` containing the following values: "start": "2022-09-06T19:45:54.406Z", // ISO 8601 Date string "end": "2022-09-07T19:45:54.406Z", // ISO 8601 Date string "timePeriodsKey": "24h" // or "" if not applicable -} +} ```