Skip to content

Commit

Permalink
fix(datetime): pickerOptions are all optional (#16101)
Browse files Browse the repository at this point in the history
fixes #16095
  • Loading branch information
manucorporat committed Oct 26, 2018
1 parent 9dfc863 commit f014181
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
Color,
ComponentProps,
ComponentRef,
DatetimeOptions,
DomRenderFn,
FrameworkDelegate,
HeaderFn,
Expand Down Expand Up @@ -1284,7 +1285,7 @@ export namespace Components {
/**
* Any additional options that the picker interface can accept. See the [Picker API docs](../../picker/Picker) for the picker options.
*/
'pickerOptions'?: PickerOptions;
'pickerOptions'?: DatetimeOptions;
/**
* The text to display when there's no date selected yet. Using lowercase to match the input attribute
*/
Expand Down Expand Up @@ -1378,7 +1379,7 @@ export namespace Components {
/**
* Any additional options that the picker interface can accept. See the [Picker API docs](../../picker/Picker) for the picker options.
*/
'pickerOptions'?: PickerOptions;
'pickerOptions'?: DatetimeOptions;
/**
* The text to display when there's no date selected yet. Using lowercase to match the input attribute
*/
Expand Down
3 changes: 3 additions & 0 deletions core/src/components/datetime/datetime-interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { PickerOptions } from '../../interface';

export type DatetimeOptions = Partial<PickerOptions>;
4 changes: 2 additions & 2 deletions core/src/components/datetime/datetime.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, ComponentInterface, Element, Event, EventEmitter, Method, Prop, State, Watch } from '@stencil/core';

import { InputChangeEvent, Mode, PickerColumn, PickerColumnOption, PickerOptions, StyleEvent } from '../../interface';
import { DatetimeOptions, InputChangeEvent, Mode, PickerColumn, PickerColumnOption, PickerOptions, StyleEvent } from '../../interface';
import { clamp } from '../../utils/helpers';
import { hostContext } from '../../utils/theme';

Expand Down Expand Up @@ -168,7 +168,7 @@ export class Datetime implements ComponentInterface {
* Any additional options that the picker interface can accept.
* See the [Picker API docs](../../picker/Picker) for the picker options.
*/
@Prop() pickerOptions?: PickerOptions;
@Prop() pickerOptions?: DatetimeOptions;

/**
* The text to display when there's no date selected yet.
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/datetime/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ dates in JavaScript.
| `monthShortNames` | `month-short-names` | Short abbreviated names for each month name. This can be used to provide locale month names. Defaults to English. | `string \| string[] \| undefined` |
| `monthValues` | -- | Values used to create the list of selectable months. By default the month values range from `1` to `12`. However, to control exactly which months to display, the `monthValues` input can take a number, an array of numbers, or a string of comma separated numbers. For example, if only summer months should be shown, then this input value would be `monthValues="6,7,8"`. Note that month numbers do *not* have a zero-based index, meaning January's value is `1`, and December's is `12`. | `number \| number[] \| string \| undefined` |
| `pickerFormat` | `picker-format` | The format of the date and time picker columns the user selects. A datetime input can have one or many datetime parts, each getting their own column which allow individual selection of that particular datetime part. For example, year and month columns are two individually selectable columns which help choose an exact date from the datetime picker. Each column follows the string parse format. Defaults to use `displayFormat`. | `string \| undefined` |
| `pickerOptions` | -- | Any additional options that the picker interface can accept. See the [Picker API docs](../../picker/Picker) for the picker options. | `PickerOptions \| undefined` |
| `pickerOptions` | -- | Any additional options that the picker interface can accept. See the [Picker API docs](../../picker/Picker) for the picker options. | `Partial<PickerOptions> \| undefined` |
| `placeholder` | `placeholder` | The text to display when there's no date selected yet. Using lowercase to match the input attribute | `null \| string \| undefined` |
| `value` | `value` | The value of the datetime as a valid ISO 8601 datetime string. | `null \| string \| undefined` |
| `yearValues` | -- | Values used to create the list of selectable years. By default the year values range between the `min` and `max` datetime inputs. However, to control exactly which years to display, the `yearValues` input can take a number, an array of numbers, or string of comma separated numbers. For example, to show upcoming and recent leap years, then this input's value would be `yearValues="2024,2020,2016,2012,2008"`. | `number \| number[] \| string \| undefined` |
Expand Down
1 change: 1 addition & 0 deletions core/src/interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from './index';
export * from './components/animation-controller/animation-interface';
export * from './components/alert/alert-interface';
export * from './components/action-sheet/action-sheet-interface';
export * from './components/datetime/datetime-interface';
export * from './components/menu/menu-interface';
export * from './components/modal/modal-interface';
export * from './components/picker/picker-interface';
Expand Down

0 comments on commit f014181

Please sign in to comment.