mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
Fix props callbacks. Type dates as moment.Moment.
This commit is contained in:
21
react-datepicker/index.d.ts
vendored
21
react-datepicker/index.d.ts
vendored
@@ -3,9 +3,10 @@
|
||||
// Definitions by: Rajab Shakirov <https://github.com/radziksh>, Andrey Balokha <https://github.com/andrewBalekha>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="react"/>
|
||||
|
||||
declare module "react-datepicker" {
|
||||
import * as React from "react";
|
||||
import * as moment from "moment";
|
||||
|
||||
interface ReactDatePickerProps {
|
||||
autoComplete?: string;
|
||||
autoFocus?: boolean;
|
||||
@@ -14,7 +15,7 @@ declare module "react-datepicker" {
|
||||
dateFormat?: string;
|
||||
dateFormatCalendar?: string;
|
||||
disabled?: boolean;
|
||||
endDate?: {};
|
||||
endDate?: moment.Moment;
|
||||
excludeDates?: any[];
|
||||
filterDate?(): any;
|
||||
fixedHeight?: boolean;
|
||||
@@ -22,12 +23,12 @@ declare module "react-datepicker" {
|
||||
includeDates?: any[];
|
||||
isClearable?: boolean;
|
||||
locale?: string;
|
||||
maxDate?: {};
|
||||
minDate?: {};
|
||||
maxDate?: moment.Moment;
|
||||
minDate?: moment.Moment;
|
||||
name?: string;
|
||||
onBlur?(handler: (e: any) => void): any;
|
||||
onChange(handler: (date?: any, e?: any) => void): any;
|
||||
onFocus?(handler: (e: any) => void): any;
|
||||
onBlur?(event: React.FocusEvent<HTMLInputElement>): void;
|
||||
onChange(date: moment.Moment | null, event: React.SyntheticEvent<any> | undefined): any;
|
||||
onFocus?(event: React.FocusEvent<HTMLInputElement>): void;
|
||||
peekNextMonth?: boolean;
|
||||
placeholderText?: string;
|
||||
popoverAttachment?: string;
|
||||
@@ -37,13 +38,13 @@ declare module "react-datepicker" {
|
||||
renderCalendarTo?: any;
|
||||
required?: boolean;
|
||||
scrollableYearDropdown?: boolean;
|
||||
selected?: {};
|
||||
selected?: moment.Moment | null;
|
||||
selectsEnd?: boolean;
|
||||
selectsStart?: boolean;
|
||||
showMonthDropdown?: boolean;
|
||||
showYearDropdown?: boolean;
|
||||
showWeekNumbers?: boolean;
|
||||
startDate?: {};
|
||||
startDate?: moment.Moment;
|
||||
tabIndex?: number;
|
||||
tetherConstraints?: any[];
|
||||
title?: string;
|
||||
|
||||
@@ -2,8 +2,8 @@ import * as React from "react";
|
||||
import * as moment from 'moment';
|
||||
import * as DatePicker from 'react-datepicker';
|
||||
|
||||
class ReactDatePicker extends React.Component<{}, {startDate:any,displayName:string}> {
|
||||
constructor(props:any) {
|
||||
class ReactDatePicker extends React.Component<{}, { startDate: moment.Moment; displayName:string; }> {
|
||||
constructor(props: {}) {
|
||||
super();
|
||||
this.state = {
|
||||
startDate: moment(),
|
||||
@@ -12,7 +12,7 @@ class ReactDatePicker extends React.Component<{}, {startDate:any,displayName:str
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
}
|
||||
|
||||
handleChange = function(date?:any) {
|
||||
handleChange = function(date?: moment.Moment | null) {
|
||||
this.setState({
|
||||
startDate: date
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user