Skip to content

Commit

Permalink
feat: add RangeCalendarWithDefaultValueExample
Browse files Browse the repository at this point in the history
  • Loading branch information
Arucard89 committed Feb 2, 2024
1 parent 1ea4df2 commit b52dd7e
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {RangeCalendar, RangeCalendarProps} from '@gravity-ui/date-components';
import {RangeValue} from '@gravity-ui/date-components/dist/esm/components/types';
import {DateTimeInput, dateTimeParse} from '@gravity-ui/date-utils';
import {DateTimeInput, dateTime, dateTimeParse} from '@gravity-ui/date-utils';
import React from 'react';

type RangeCalendarExampleProps = {
Expand Down Expand Up @@ -53,3 +53,16 @@ export const RangeCalendarExample = ({
</div>
);
};

type RangeCalendarWithDefaultValueExampleProps = Omit<RangeCalendarExampleProps, 'defaultValue'>;

export const RangeCalendarWithDefaultValueExample = (
props: RangeCalendarWithDefaultValueExampleProps,
) => {
const today = dateTime();
const defaultValue: RangeValue<string> = {
start: today.subtract({days: 2}).toString(),
end: today.add({days: 2}).toString(),
};
return <RangeCalendarExample {...props} defaultValue={defaultValue} />;
};

0 comments on commit b52dd7e

Please sign in to comment.