| | |
| | | // Project: https://github.com/YouCanBookMe/react-datetime |
| | | // Definitions by: Ivan Verevkin <vereva@x-root.org> |
| | | |
| | | // These are the typings for Typescript 1.8 |
| | | // for Typescript 2.0+ see DateTime.d.ts |
| | | |
| | | //// <reference path="../moment/moment-node.d.ts" /> |
| | | |
| | | declare module ReactDatetime { |
| | |
| | | This prop is parsed by moment.js, so it is possible to use a date string or a moment.js date. |
| | | */ |
| | | defaultValue?: Date; |
| | | /* |
| | | Represents the month which is viewed on opening the calendar when there is no selected date. |
| | | This prop is parsed by Moment.js, so it is possible to use a date `string` or a `moment` object. |
| | | */ |
| | | viewDate?: Date; |
| | | /* |
| | | Defines the format for the date. It accepts any moment.js date format. |
| | | If true the date will be displayed using the defaults for the current locale. |
| | |
| | | */ |
| | | locale?: string; |
| | | /* |
| | | Whether to interpret input times as UTC or the user's local timezone. |
| | | */ |
| | | utc?: boolean; |
| | | /* |
| | | Callback trigger when the date changes. The callback receives the selected `moment` object as |
| | | only parameter, if the date in the input is valid. If the date in the input is not valid, the |
| | | callback receives the value of the input (a string). |
| | |
| | | */ |
| | | onBlur?: (momentOrInputString : string|any) => void; |
| | | /* |
| | | Callback trigger when the view mode changes. The callback receives the selected view mode |
| | | string ('years', 'months', 'days', 'time') as only parameter. |
| | | */ |
| | | onViewModeChange?: (viewMode: string) => void; |
| | | /* |
| | | Callback trigger when the user navigates to the previous month, year or decade. |
| | | The callback receives the amount and type ('month', 'year') as parameters. |
| | | */ |
| | | onNavigateBack?: (amount: number, type: string) => void; |
| | | /* |
| | | Callback trigger when the user navigates to the next month, year or decade. |
| | | The callback receives the amount and type ('month', 'year') as parameters. |
| | | */ |
| | | onNavigateForward?: (amount: number, type: string) => void; |
| | | /* |
| | | The default view to display when the picker is shown. ('years', 'months', 'days', 'time') |
| | | */ |
| | | viewMode?: string|number; |
| | |
| | | Defines additional attributes for the input element of the component. |
| | | */ |
| | | inputProps?: Object; |
| | | /* |
| | | Replace the rendering of the input element. The accepted function has openCalendar |
| | | (a function which opens the calendar) and the default calculated props for the input. |
| | | Must return a React component or null. |
| | | */ |
| | | renderInput?: (props: Object, openCalendar: Function) => React.Component<any, any>; |
| | | /* |
| | | Define the dates that can be selected. The function receives (currentDate, selectedDate) |
| | | and should return a true or false whether the currentDate is valid or not. See selectable dates. |
| | |
| | | it will change adding or subtracting 2 hours everytime the buttons are clicked. The constraints |
| | | can be added to the hours, minutes, seconds and milliseconds. |
| | | */ |
| | | timeConstraints?: Object; |
| | | timeConstraints?: Object; |
| | | /* |
| | | When true, keep the picker open when click event is triggered outside of component. When false, |
| | | close it. |