import * as React from 'react'; import {withInfo} from '@storybook/addon-info'; import {boolean, select, text, withKnobs} from '@storybook/addon-knobs'; import {storyLayout} from '../../index.stories'; import {DateRangePicker, DateRangeTemplate} from './DateRangePicker'; import * as moment from 'moment'; // eslint-disable-next-line no-restricted-syntax export default { title: 'DatePicker', decorators: [withInfo, withKnobs, storyLayout] }; export const dateRangePicker = () => { const [value, setValue]:[[string, string], any] = React.useState(['', '']); const templates: DateRangeTemplate[] = [ {name: 'Today', date: [moment().startOf('day'), moment().endOf('day')]}, {name: 'Current month', date: [moment().startOf('month'), moment().endOf('month')]}, {name: 'Current year', date: [moment().startOf('year'), moment().endOf('year')]} ]; return ( <> { setValue(date); }} value={value} additionalDateTemplates={templates} i18nLocale={select('i18nLocale', ['ru', 'en'], 'ru')} errorTimeMessage={'Not a time'} /> ); };