Skip to content

Commit 3551b79

Browse files
committed
Use correct types for props value & defaultValue
The changed props definitions actually accept more than just a JS date object, and the TS definition should reflect this. Fixes arqex#336.
1 parent f37c3f9 commit 3551b79

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

DateTime.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,24 @@ declare namespace ReactDatetimeClass {
3535
Represents the selected date by the component, in order to use it as a controlled component.
3636
This prop is parsed by moment.js, so it is possible to use a date string or a moment.js date.
3737
*/
38-
value?: Date;
38+
value?: Date | string | Moment;
3939
/*
4040
Represents the selected date for the component to use it as a uncontrolled component.
4141
This prop is parsed by moment.js, so it is possible to use a date string or a moment.js date.
4242
*/
43-
defaultValue?: Date;
43+
defaultValue?: Date | string | Moment;
4444
/*
4545
Defines the format for the date. It accepts any moment.js date format.
4646
If true the date will be displayed using the defaults for the current locale.
4747
If false the datepicker is disabled and the component can be used as timepicker.
4848
*/
49-
dateFormat?: boolean|string;
49+
dateFormat?: boolean | string;
5050
/*
5151
Defines the format for the time. It accepts any moment.js time format.
5252
If true the time will be displayed using the defaults for the current locale.
5353
If false the timepicker is disabled and the component can be used as datepicker.
5454
*/
55-
timeFormat?: boolean|string;
55+
timeFormat?: boolean | string;
5656
/*
5757
Whether to show an input field to edit the date manually.
5858
*/
@@ -96,7 +96,7 @@ declare namespace ReactDatetimeClass {
9696
/*
9797
The default view to display when the picker is shown. ('years', 'months', 'days', 'time')
9898
*/
99-
viewMode?: ViewMode|number;
99+
viewMode?: ViewMode | number;
100100
/*
101101
Extra class names for the component markup.
102102
*/

0 commit comments

Comments
 (0)