/// /// // Test app from https://github.com/onefinestay/react-daterange-picker/blob/master/example/index.jsx import * as React from 'react'; import * as ReactDOM from 'react-dom'; import * as moment from 'moment'; import 'moment-range'; import * as DateRangePicker from 'react-daterange-picker'; interface AppProps extends ReactDateRangePicker.Props { } class App extends React.Component { constructor(props: AppProps, context: any) { super(props, context); this.state = {}; } handleSelect(value: AppProps, states: any): void { this.setState({value, states}); } render(): any { return ( ); } } class DateSinglePicker extends React.Component { constructor(props : AppProps, context: any) { super(props, context); this.state = {}; } handleSelect(value: AppProps) { this.setState({value: value}); } render() { return ( ); } } export class Main extends React.Component { render() { const stateDefinitions: ReactDateRangePicker.StateDefinitions = { available: { color: '#ffffff', label: 'Available', }, enquire: { color: '#ffd200', label: 'Enquire', }, unavailable: { selectable: false, color: '#78818b', label: 'Unavailable', } }; const dateRanges = [ { state: 'enquire', range: moment.range( moment().add(2, 'weeks').subtract(5, 'days'), moment().add(2, 'weeks').add(6, 'days') ), }, { state: 'unavailable', range: moment.range( moment().add(3, 'weeks'), moment().add(3, 'weeks').add(5, 'days') ), }, ]; const initialStart = moment().add(1, 'weeks').startOf('day'); const initialEnd = moment().add(1, 'weeks').add(3, 'days').startOf('day'); const range = moment.range(initialStart, initialEnd); return ( Examples Range with no date states Range with day-long ranges allowed Range with no minimum date Single with no date states ); } } const MainFactory = React.createFactory(Main); ReactDOM.render( MainFactory(), document.getElementById('app') );