diff --git a/src/components/RangeDateSelection/hooks/useRangeDateSelectionState.ts b/src/components/RangeDateSelection/hooks/useRangeDateSelectionState.ts index e5c1002..4731b47 100644 --- a/src/components/RangeDateSelection/hooks/useRangeDateSelectionState.ts +++ b/src/components/RangeDateSelection/hooks/useRangeDateSelectionState.ts @@ -9,11 +9,16 @@ import {constrainValue, createPlaceholderValue} from '../../utils/dates'; import {useDefaultTimeZone} from '../../utils/useDefaultTimeZone'; import {alignDateTime} from '../utils/date'; -function getViewPortIntervalFromDates(start: DateTime, end: DateTime, parts = 4, fraction = 0.5) { +function getViewportIntervalFromDates( + start: DateTime, + end: DateTime, + numberOfIntervals = 4, + placeInViewport = 0.5, +) { const diff = end.diff(start); return { - start: start.subtract(diff * (parts - 1) * fraction), - end: end.add(diff * (parts - 1) * (1 - fraction)), + start: start.subtract(diff * (numberOfIntervals - 1) * placeInViewport), + end: end.add(diff * (numberOfIntervals - 1) * (1 - placeInViewport)), }; } @@ -52,11 +57,19 @@ export interface RangeDateSelectionOptions extends ValueBase