@synerise/ds-date-range-picker 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/DateRangePicker.js +1 -1
- package/dist/DateRangePicker.types.d.ts +2 -2
- package/dist/Footer/Footer.js +3 -3
- package/dist/RangeFilter/Filters/MonthlyFilter/MonthlyFilter.js +2 -2
- package/dist/RangeFilter/Filters/MonthlyFilter/MonthlyFilter.types.d.ts +1 -1
- package/dist/RangeFilter/Filters/new/Daily/Daily.js +1 -1
- package/dist/RangeFilter/Filters/new/Monthly/Monthly.js +3 -3
- package/dist/RangeFilter/Filters/new/Monthly/Monthly.types.d.ts +1 -1
- package/dist/RangeFilter/Filters/new/Weekly/Weekly.js +2 -2
- package/dist/RangeFilter/RangeFilter.js +1 -1
- package/dist/RangeFilter/RangeFilter.types.d.ts +1 -1
- package/dist/RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.utils.js +3 -3
- package/dist/RangeFilter/Shared/TimeWindow/TimeWindow.js +2 -2
- package/dist/RangeFilter/utils.js +5 -5
- package/dist/RangePicker/RangePicker.js +1 -1
- package/dist/RangePicker/utils.js +2 -2
- package/dist/RawDateRangePicker.js +4 -4
- package/dist/RelativeRangePicker/Elements/RangeButtons/RangeButtons.js +2 -2
- package/dist/RelativeRangePicker/Elements/RangeDropdown/RangeDropdown.js +2 -2
- package/dist/RelativeRangePicker/RelativeRangePicker.js +4 -4
- package/dist/RelativeRangePicker/utils/getCurrentGroupFromProps.utils.js +1 -1
- package/dist/RelativeRangePicker/utils/index.d.ts +6 -6
- package/dist/RelativeRangePicker/utils/index.js +6 -6
- package/dist/dateUtils/endOf.js +2 -2
- package/dist/dateUtils/relativeToAbsolute.js +6 -6
- package/dist/dateUtils/startOf.js +2 -2
- package/dist/fns.d.ts +1 -20
- package/dist/index.d.ts +9 -9
- package/dist/index.js +13 -13
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +8 -8
- package/package.json +22 -22
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.1.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@2.1.2...@synerise/ds-date-range-picker@2.1.3) (2026-09-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **core:** move test helpers to a ./testing subpath export ([b38cd82](https://github.com/Synerise/synerise-design/commit/b38cd82c956111d2331d5c1e0efd1935366f1139))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [2.1.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@2.1.1...@synerise/ds-date-range-picker@2.1.2) (2026-09-18)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [2.1.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-range-picker@2.1.0...@synerise/ds-date-range-picker@2.1.1) (2026-09-16)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-date-range-picker
|
package/dist/DateRangePicker.js
CHANGED
|
@@ -3,10 +3,10 @@ import isEqual from "lodash.isequal";
|
|
|
3
3
|
import { forwardRef, useState, useMemo, useEffect, useCallback } from "react";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
5
|
import { getPlacement, Popover, PopoverContent } from "@synerise/ds-popover";
|
|
6
|
+
import { POPOVER_SHIFT_CONFIG, POPOVER_FLIP_CONFIG, POPOVER_OFFSET_CONFIG } from "./constants.js";
|
|
6
7
|
import { PickerWrapper, DateRangePickerOverlay, PickerTrigger } from "./DateRangePicker.styles.js";
|
|
7
8
|
import RangePickerInput from "./RangePickerInput/RangePickerInput.js";
|
|
8
9
|
import { RawDateRangePicker } from "./RawDateRangePicker.js";
|
|
9
|
-
import { POPOVER_SHIFT_CONFIG, POPOVER_FLIP_CONFIG, POPOVER_OFFSET_CONFIG } from "./constants.js";
|
|
10
10
|
import { getDefaultTexts } from "./utils.js";
|
|
11
11
|
const DateRangePicker = forwardRef((props, forwardedRef) => {
|
|
12
12
|
const {
|
|
@@ -2,13 +2,13 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { IntlShape } from 'react-intl';
|
|
3
3
|
import { DateToFormatOptions } from '@synerise/ds-core';
|
|
4
4
|
import { LegacyPlacement, PopoverProps } from '@synerise/ds-popover';
|
|
5
|
+
import { DateFilter, DateRange, DateRangePreset, RelativeUnits } from './date.types';
|
|
5
6
|
import { Props as FooterProps } from './Footer/Footer.types';
|
|
7
|
+
import { RangeFilterType } from './RangeFilter/constants';
|
|
6
8
|
import { FilterDefinition } from './RangeFilter/RangeFilter.types';
|
|
7
9
|
import { SavedFilter } from './RangeFilter/Shared/FilterDropdown/FilterDropdown.types';
|
|
8
10
|
import { DateLimitMode, RangeDisplayMode } from './RangeFilter/Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types';
|
|
9
|
-
import { RangeFilterType } from './RangeFilter/constants';
|
|
10
11
|
import { RangePickerInputProps } from './RangePickerInput/RangePickerInput.types';
|
|
11
|
-
import { DateFilter, DateRange, DateRangePreset, RelativeUnits } from './date.types';
|
|
12
12
|
export type DateRangePickerProps = {
|
|
13
13
|
/**
|
|
14
14
|
* @deprecated use `valueFormatOptions` instead
|
package/dist/Footer/Footer.js
CHANGED
|
@@ -5,8 +5,8 @@ import Button from "@synerise/ds-button";
|
|
|
5
5
|
import { useDataFormat, getDefaultDataTimeOptions } from "@synerise/ds-core";
|
|
6
6
|
import Icon, { ArrowRightS } from "@synerise/ds-icon";
|
|
7
7
|
import Tooltip from "@synerise/ds-tooltip";
|
|
8
|
-
import { isLifetime } from "../RelativeRangePicker/Elements/RangeDropdown/RangeDropdown.js";
|
|
9
8
|
import { ALL_TIME } from "../constants.js";
|
|
9
|
+
import { isLifetime } from "../RelativeRangePicker/Elements/RangeDropdown/RangeDropdown.js";
|
|
10
10
|
import { ChosenRange, InvisibleTextContent, Container, ActionsPlaceholder, Actions } from "./Footer.styles.js";
|
|
11
11
|
const Footer = ({
|
|
12
12
|
canApply,
|
|
@@ -41,10 +41,10 @@ const Footer = ({
|
|
|
41
41
|
return /* @__PURE__ */ jsx(ChosenRange, { className: "ds-date-range-picker-value", children: value?.translationKey ? texts[value.translationKey] ?? value.translationKey : value?.key || "LIFETIME" });
|
|
42
42
|
}
|
|
43
43
|
return /* @__PURE__ */ jsxs(ChosenRange, { className: displayDateContainerClass, children: [
|
|
44
|
-
|
|
44
|
+
value && value.from ? footerDateToString(value?.from) : texts.startDatePlaceholder,
|
|
45
45
|
/* @__PURE__ */ jsx(InvisibleTextContent, { children: " – " }),
|
|
46
46
|
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(ArrowRightS, {}) }),
|
|
47
|
-
|
|
47
|
+
value && value.to ? footerDateToString(value?.to) : texts.endDatePlaceholder
|
|
48
48
|
] });
|
|
49
49
|
}, [value, texts, displayDateContainerClass, footerDateToString]);
|
|
50
50
|
return /* @__PURE__ */ jsxs(Container, { className: "ds-date-range-picker-footer", ...rest, children: [
|
|
@@ -7,8 +7,8 @@ import { theme } from "@synerise/ds-core";
|
|
|
7
7
|
import { ContentItem } from "@synerise/ds-manageable-list";
|
|
8
8
|
import Tag, { TagShape } from "@synerise/ds-tag";
|
|
9
9
|
import { getDefaultTexts } from "../../../utils.js";
|
|
10
|
-
import TimeWindow from "../../Shared/TimeWindow/TimeWindow.js";
|
|
11
10
|
import { defaultId, DEFAULT_DAYS_OF_PERIODS, DEFAULT_COUNTED_FROM, MONTH_DAYS, DAYS_OF_PERIOD_ENUM, COUNTED_FROM_ENUM, SPACE_UNICODE } from "../../constants.js";
|
|
11
|
+
import TimeWindow from "../../Shared/TimeWindow/TimeWindow.js";
|
|
12
12
|
import { PeriodMode, Select, MonthlyFilterWrapper, ContentWrapper, DropdownHeader, DropdownLabel, AddContainer } from "./MonthlyFilter.styles.js";
|
|
13
13
|
const _MonthlyFilter = class _MonthlyFilter extends PureComponent {
|
|
14
14
|
constructor() {
|
|
@@ -280,7 +280,7 @@ const _MonthlyFilter = class _MonthlyFilter extends PureComponent {
|
|
|
280
280
|
tag: /* @__PURE__ */ jsx(Tag, { name: String(key + 1), shape: TagShape.SINGLE_CHARACTER_ROUND, color: theme.palette["grey-100"], textColor: theme.palette["grey-500"] }),
|
|
281
281
|
canDelete: !disabled && deletableDueToEntriesLimit(key),
|
|
282
282
|
id: item.id,
|
|
283
|
-
// @ts-
|
|
283
|
+
// @ts-expect-error
|
|
284
284
|
name: /* @__PURE__ */ jsxs(DropdownHeader, { onClick: (event) => event.stopPropagation(), className: visible[item.id] ? "dropdown-header-visible" : "dropdown-header", children: [
|
|
285
285
|
/* @__PURE__ */ jsxs(DropdownLabel, { children: [
|
|
286
286
|
allTexts.daysOf,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { IntlShape } from 'react-intl';
|
|
2
2
|
import { TimePickerProps } from '@synerise/ds-time-picker';
|
|
3
3
|
import { WithTranslations } from '../../../DateRangePicker.types';
|
|
4
|
+
import { COUNTED_FROM_ENUM, DAYS_OF_PERIOD_ENUM } from '../../constants';
|
|
4
5
|
import { DenormalizedFilter, FilterDefinition, MonthlySelectValue, WithDisabledProp } from '../../RangeFilter.types';
|
|
5
6
|
import { DateLimitMode, RangeDisplayMode } from '../../Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types';
|
|
6
7
|
import { RangeActions } from '../../Shared/TimeWindow/TimeWindow.types';
|
|
7
|
-
import { COUNTED_FROM_ENUM, DAYS_OF_PERIOD_ENUM } from '../../constants';
|
|
8
8
|
export type MonthlyFilterProps = {
|
|
9
9
|
maxEntries?: number;
|
|
10
10
|
value: Month[];
|
|
@@ -54,7 +54,7 @@ const Daily = ({
|
|
|
54
54
|
onChange([...updatedSchedule]);
|
|
55
55
|
}, [value, onChange]);
|
|
56
56
|
const getDayValue = useCallback((index) => {
|
|
57
|
-
if (typeof index === "number" &&
|
|
57
|
+
if (typeof index === "number" && value[index]) {
|
|
58
58
|
return value[index];
|
|
59
59
|
}
|
|
60
60
|
return defaultDayValue;
|
|
@@ -5,6 +5,7 @@ import { useIntl } from "react-intl";
|
|
|
5
5
|
import { v4 } from "uuid";
|
|
6
6
|
import { useDataFormat } from "@synerise/ds-core";
|
|
7
7
|
import { getDefaultTexts } from "../../../../utils.js";
|
|
8
|
+
import { DAYS_OF_PERIOD_ENUM, MONTHLY_SCHEDULER_INTL_KEYS_WEEKDAYS_LONG, MONTHLY_SCHEDULER_INTL_KEYS_NTH_WEEK, MONTHLY_SCHEDULER_INTL_KEYS_WEEKDAYS_SHORT, MONTH_DAYS, COUNTED_FROM_ENUM } from "../../../constants.js";
|
|
8
9
|
import { NewFilterContainer } from "../../../RangeFilter.styles.js";
|
|
9
10
|
import AddButton from "../../../Shared/AddButton/AddButton.js";
|
|
10
11
|
import "@synerise/ds-button";
|
|
@@ -20,11 +21,10 @@ import "@synerise/ds-input";
|
|
|
20
21
|
import SelectionCount from "../../../Shared/SelectionCount/SelectionCount.js";
|
|
21
22
|
import SelectionHint from "../../../Shared/SelectionHint/SelectionHint.js";
|
|
22
23
|
import "../../../Shared/TimeWindow/TimeWindow.js";
|
|
24
|
+
import { US_NOTATION_WEEK_DAYS_INDEXES } from "../../../Shared/TimeWindow/constants/timeWindow.constants.js";
|
|
23
25
|
import Day from "../../../Shared/TimeWindow/Day/Day.js";
|
|
24
26
|
import Grid from "../../../Shared/TimeWindow/Grid/Grid.js";
|
|
25
27
|
import RangeFormContainer from "../../../Shared/TimeWindow/RangeFormContainer/RangeFormContainer.js";
|
|
26
|
-
import { US_NOTATION_WEEK_DAYS_INDEXES } from "../../../Shared/TimeWindow/constants/timeWindow.constants.js";
|
|
27
|
-
import { DAYS_OF_PERIOD_ENUM, MONTHLY_SCHEDULER_INTL_KEYS_WEEKDAYS_LONG, MONTHLY_SCHEDULER_INTL_KEYS_NTH_WEEK, MONTHLY_SCHEDULER_INTL_KEYS_WEEKDAYS_SHORT, MONTH_DAYS, COUNTED_FROM_ENUM } from "../../../constants.js";
|
|
28
28
|
import { DEFAULT_RANGE_END, DEFAULT_RANGE_START, NOOP, DEFAULT_TIME_FORMAT, EMPTY_OBJECT, DEFAULT_MAX_ENTRIES, RENDER_EMPTY_NODE_FN } from "../constants.js";
|
|
29
29
|
import { useShiftAndControlKeys } from "../hooks/useShiftAndControlKeys.js";
|
|
30
30
|
import { range, haveActiveDaysCommonRange, canAddAnotherRange } from "./utils.js";
|
|
@@ -135,7 +135,7 @@ const Monthly = ({
|
|
|
135
135
|
onChange(updatedSchedule);
|
|
136
136
|
}, [value, onChange]);
|
|
137
137
|
const getDayValue = useCallback((dayKey, guid) => {
|
|
138
|
-
if (typeof dayKey === "number" && value[guid] &&
|
|
138
|
+
if (typeof dayKey === "number" && value[guid] && value[guid][dayKey]) {
|
|
139
139
|
return value[guid][dayKey];
|
|
140
140
|
}
|
|
141
141
|
return defaultDayValue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Texts } from '../../../../DateRangePicker.types';
|
|
2
|
+
import { COUNTED_FROM_ENUM, DAYS_OF_PERIOD_ENUM } from '../../../constants';
|
|
2
3
|
import { WithDisabledProp } from '../../../RangeFilter.types';
|
|
3
4
|
import { DateLimitMode } from '../../../Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types';
|
|
4
5
|
import { FilterErrorType } from '../../../Shared/TimeWindow/RangeFormContainer/RangeFormContainer.types';
|
|
5
6
|
import { DayOptions } from '../../../Shared/TimeWindow/TimeWindow.types';
|
|
6
|
-
import { COUNTED_FROM_ENUM, DAYS_OF_PERIOD_ENUM } from '../../../constants';
|
|
7
7
|
import { FilterBaseProps } from '../Filters.types';
|
|
8
8
|
export type MonthlyScheduleDayValue = DayOptions & {
|
|
9
9
|
mode: DateLimitMode;
|
|
@@ -20,10 +20,10 @@ import "@synerise/ds-input";
|
|
|
20
20
|
import SelectionCount from "../../../Shared/SelectionCount/SelectionCount.js";
|
|
21
21
|
import SelectionHint from "../../../Shared/SelectionHint/SelectionHint.js";
|
|
22
22
|
import "../../../Shared/TimeWindow/TimeWindow.js";
|
|
23
|
+
import { US_NOTATION_WEEK_DAYS_INDEXES, EU_NOTATION_WEEK_DAYS_INDEXES } from "../../../Shared/TimeWindow/constants/timeWindow.constants.js";
|
|
23
24
|
import Day from "../../../Shared/TimeWindow/Day/Day.js";
|
|
24
25
|
import Grid from "../../../Shared/TimeWindow/Grid/Grid.js";
|
|
25
26
|
import RangeFormContainer from "../../../Shared/TimeWindow/RangeFormContainer/RangeFormContainer.js";
|
|
26
|
-
import { US_NOTATION_WEEK_DAYS_INDEXES, EU_NOTATION_WEEK_DAYS_INDEXES } from "../../../Shared/TimeWindow/constants/timeWindow.constants.js";
|
|
27
27
|
import { DEFAULT_RANGE_END, DEFAULT_RANGE_START, DEFAULT_TIME_FORMAT, NOOP, EMPTY_OBJECT, DEFAULT_MAX_ENTRIES, RENDER_EMPTY_NODE_FN } from "../constants.js";
|
|
28
28
|
import { useShiftAndControlKeys } from "../hooks/useShiftAndControlKeys.js";
|
|
29
29
|
import { removeEmptyEntries, haveActiveDaysCommonRange, range, canAddAnotherRange } from "./utils.js";
|
|
@@ -94,7 +94,7 @@ const Weekly = ({
|
|
|
94
94
|
onChange(updatedSchedule);
|
|
95
95
|
}, [value, onChange]);
|
|
96
96
|
const getDayValue = useCallback((dayKey, guid) => {
|
|
97
|
-
if (typeof dayKey === "number" && value[guid] &&
|
|
97
|
+
if (typeof dayKey === "number" && value[guid] && value[guid][dayKey]) {
|
|
98
98
|
return value[guid][dayKey];
|
|
99
99
|
}
|
|
100
100
|
return defaultDayValue;
|
|
@@ -6,10 +6,10 @@ import { v4 } from "uuid";
|
|
|
6
6
|
import Button from "@synerise/ds-button";
|
|
7
7
|
import ButtonGroup from "@synerise/ds-button-group";
|
|
8
8
|
import { getDefaultTexts } from "../utils.js";
|
|
9
|
+
import { TYPES_DATA, TYPES } from "./constants.js";
|
|
9
10
|
import { Container, Header, Title, Body, MainComponentWrapper, Footer, FooterSeparator } from "./RangeFilter.styles.js";
|
|
10
11
|
import FilterDropdown from "./Shared/FilterDropdown/FilterDropdown.js";
|
|
11
12
|
import SaveFilterForm from "./Shared/SaveFilterForm/SaveFilterForm.js";
|
|
12
|
-
import { TYPES_DATA, TYPES } from "./constants.js";
|
|
13
13
|
import { normalizeValue, addSuffixToDuplicate, denormalizeValue, isValidValue } from "./utils.js";
|
|
14
14
|
const _RangeFilter = class _RangeFilter extends React.PureComponent {
|
|
15
15
|
constructor(props) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { IntlShape } from 'react-intl';
|
|
3
3
|
import { DateRangePickerProps, Texts } from '../DateRangePicker.types';
|
|
4
|
+
import { COUNTED_FROM_ENUM, DAYS_OF_PERIOD_ENUM, RangeFilterType } from './constants';
|
|
4
5
|
import { SavedFilter } from './Shared/FilterDropdown/FilterDropdown.types';
|
|
5
6
|
import { DateLimitMode, RangeDisplayMode } from './Shared/TimeWindow/RangeFormContainer/RangeForm/RangeForm.types';
|
|
6
|
-
import { COUNTED_FROM_ENUM, DAYS_OF_PERIOD_ENUM, RangeFilterType } from './constants';
|
|
7
7
|
export type FilterValue<T = FilterDefinition> = {
|
|
8
8
|
definition?: Partial<T>;
|
|
9
9
|
type: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import endOf from "../../../../../dateUtils/endOf.js";
|
|
3
|
+
import startOf from "../../../../../dateUtils/startOf.js";
|
|
4
4
|
const numberToDate = (number, max, isRangeStart) => {
|
|
5
5
|
if (number === max) {
|
|
6
6
|
return dayjs().endOf("day").toDate();
|
|
@@ -8,7 +8,7 @@ const numberToDate = (number, max, isRangeStart) => {
|
|
|
8
8
|
const hours = Math.floor(number);
|
|
9
9
|
const minutes = 60 * (number % 1);
|
|
10
10
|
const result = dayjs().hour(hours).minute(minutes).toDate();
|
|
11
|
-
return isRangeStart ?
|
|
11
|
+
return isRangeStart ? startOf.MINUTES(result) : endOf.MINUTES(result);
|
|
12
12
|
};
|
|
13
13
|
const dateToNumber = (date) => {
|
|
14
14
|
const integer = date.getHours();
|
|
@@ -2,17 +2,17 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import range from "lodash.range";
|
|
4
4
|
import { PureComponent, createRef } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { FormattedMessage, injectIntl } from "react-intl";
|
|
6
6
|
import { withDataFormat } from "@synerise/ds-core";
|
|
7
7
|
import { DEFAULT_RANGE_END, DEFAULT_RANGE_START, TIME_FORMAT } from "../../constants.js";
|
|
8
8
|
import AddButton from "../AddButton/AddButton.js";
|
|
9
9
|
import SelectionCount from "../SelectionCount/SelectionCount.js";
|
|
10
10
|
import SelectionHint from "../SelectionHint/SelectionHint.js";
|
|
11
|
+
import { EU_NOTATION_WEEK_DAYS_INDEXES, EU_NOTATION_MONTH_DAYS_INDEXES, US_NOTATION_WEEK_DAYS_INDEXES, US_NOTATION_MONTH_DAYS_INDEXES } from "./constants/timeWindow.constants.js";
|
|
11
12
|
import Day from "./Day/Day.js";
|
|
12
13
|
import Grid from "./Grid/Grid.js";
|
|
13
14
|
import RangeFormContainer from "./RangeFormContainer/RangeFormContainer.js";
|
|
14
15
|
import { TimeWindowContainer, AddButtonWrapper } from "./TimeWindow.styles.js";
|
|
15
|
-
import { EU_NOTATION_WEEK_DAYS_INDEXES, EU_NOTATION_MONTH_DAYS_INDEXES, US_NOTATION_WEEK_DAYS_INDEXES, US_NOTATION_MONTH_DAYS_INDEXES } from "./constants/timeWindow.constants.js";
|
|
16
16
|
import { getDateFromDayValue } from "./utils.js";
|
|
17
17
|
const DEFAULT_LIMIT_MODE = "Range";
|
|
18
18
|
const _TimeWindowBase = class _TimeWindowBase extends PureComponent {
|
|
@@ -33,7 +33,7 @@ const denormMapTimeSchema = (item) => {
|
|
|
33
33
|
const normalizeValue = ({
|
|
34
34
|
type,
|
|
35
35
|
definition
|
|
36
|
-
//
|
|
36
|
+
// biome-ignore lint/suspicious/noExplicitAny: upstream type is not expressible here
|
|
37
37
|
}) => {
|
|
38
38
|
const result = {
|
|
39
39
|
type,
|
|
@@ -62,7 +62,7 @@ const normalizeValue = ({
|
|
|
62
62
|
rules.push({
|
|
63
63
|
weeks: Object.entries(groupBy(days, "week")).map(([week, daysArray]) => ({
|
|
64
64
|
week: +week + 1,
|
|
65
|
-
//
|
|
65
|
+
// biome-ignore lint/suspicious/noExplicitAny: upstream type is not expressible here
|
|
66
66
|
days: daysArray.map((day) => {
|
|
67
67
|
const dayOfWeek = (day.day - 1) % 7 + 1;
|
|
68
68
|
return {
|
|
@@ -114,7 +114,7 @@ const createWeeklyRange = (days) => range(0, 8).reduce((acc, i) => {
|
|
|
114
114
|
} : acc;
|
|
115
115
|
}, {});
|
|
116
116
|
const createMonthlyWeekDayRange = (rules) => (
|
|
117
|
-
//
|
|
117
|
+
// biome-ignore lint/complexity/noBannedTypes: intentional empty shape
|
|
118
118
|
range(0, 7 * 5 + 1).reduce((acc, i) => {
|
|
119
119
|
const weekStartIndex = Math.floor(i / 7);
|
|
120
120
|
const week = weekStartIndex;
|
|
@@ -143,7 +143,7 @@ const createMonthlyWeekDayRange = (rules) => (
|
|
|
143
143
|
}, {})
|
|
144
144
|
);
|
|
145
145
|
const createMonthlyDayRange = (rules) => (
|
|
146
|
-
//
|
|
146
|
+
// biome-ignore lint/complexity/noBannedTypes: intentional empty shape
|
|
147
147
|
range(0, 32).reduce((acc, i) => {
|
|
148
148
|
const day = rules.days && rules.days.find((d) => d.day === i);
|
|
149
149
|
return day ? {
|
|
@@ -168,7 +168,7 @@ const denormalizers = {
|
|
|
168
168
|
period: value.type,
|
|
169
169
|
id: Math.random(),
|
|
170
170
|
periodType: value.inverted ? COUNTED_FROM_ENUM.ENDING : COUNTED_FROM_ENUM.BEGINNING,
|
|
171
|
-
// @ts-
|
|
171
|
+
// @ts-expect-error
|
|
172
172
|
definition: monthlyDenormalizers[value.type](value)
|
|
173
173
|
}));
|
|
174
174
|
}
|
|
@@ -6,11 +6,11 @@ import { YearPicker, MonthPicker, fnsDifferenceInYears, DayPicker, localeUtils,
|
|
|
6
6
|
import { DayBackground, DayText, DayForeground } from "@synerise/ds-date-picker/dist/Elements/DayPicker/DayPicker.styles";
|
|
7
7
|
import Icon, { CalendarM, ClockM } from "@synerise/ds-icon";
|
|
8
8
|
import Tooltip from "@synerise/ds-tooltip";
|
|
9
|
-
import { Range } from "../RelativeRangePicker/RelativeRangePicker.styles.js";
|
|
10
9
|
import { ABSOLUTE, COLUMNS, MODES } from "../constants.js";
|
|
11
10
|
import ADD from "../dateUtils/add.js";
|
|
12
11
|
import getDateFromString from "../dateUtils/getDateFromString.js";
|
|
13
12
|
import toDateValue from "../dateUtils/toDateValue.js";
|
|
13
|
+
import { Range } from "../RelativeRangePicker/RelativeRangePicker.styles.js";
|
|
14
14
|
import { Sides, Side, PickerFooter, FooterSeparator, DateTimeModeSwitch } from "./RangePicker.styles.js";
|
|
15
15
|
import { getModifiers, getDisabledTimeOptions, getSidesState } from "./utils.js";
|
|
16
16
|
const isDayBefore = (day, reference) => isBefore(startOfDay(day), startOfDay(reference));
|
|
@@ -110,8 +110,8 @@ const getModifiers = (from, to, enteredTo) => {
|
|
|
110
110
|
start: toDateValue(enteredStart),
|
|
111
111
|
end: toDateValue(enteredEnd)
|
|
112
112
|
}) : enteredTo;
|
|
113
|
-
const startModifier = isSelecting &&
|
|
114
|
-
const endModifier = isSelecting &&
|
|
113
|
+
const startModifier = isSelecting && enteredTo && from && enteredTo < from ? void 0 : from;
|
|
114
|
+
const endModifier = isSelecting && enteredTo && from && enteredTo < from ? from : to;
|
|
115
115
|
return {
|
|
116
116
|
start: toDate(startModifier),
|
|
117
117
|
end: toDate(endModifier),
|
|
@@ -5,16 +5,16 @@ import omitBy from "lodash.omitby";
|
|
|
5
5
|
import { useState, useEffect, useMemo, useCallback } from "react";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
7
|
import AddonCollapse from "./AddonCollapse/AddonCollapse.js";
|
|
8
|
+
import { MODES, ALL_TIME, RELATIVE, ABSOLUTE, RELATIVE_PRESETS, ABSOLUTE_PRESETS, CUSTOM_RANGE_KEY } from "./constants.js";
|
|
8
9
|
import { Container, Separator, Addon, DateRangePickerWrapper } from "./DateRangePicker.styles.js";
|
|
10
|
+
import relativeToAbsolute from "./dateUtils/relativeToAbsolute.js";
|
|
11
|
+
import toDateValue from "./dateUtils/toDateValue.js";
|
|
9
12
|
import Footer from "./Footer/Footer.js";
|
|
10
13
|
import RangeFilter from "./RangeFilter/RangeFilter.js";
|
|
11
14
|
import RangeFilterStatus from "./RangeFilter/Shared/RangeFilterStatus/RangeFilterStatus.js";
|
|
12
15
|
import RangePicker from "./RangePicker/RangePicker.js";
|
|
13
16
|
import { isLifetime } from "./RelativeRangePicker/Elements/RangeDropdown/RangeDropdown.js";
|
|
14
17
|
import RelativeRangePicker from "./RelativeRangePicker/RelativeRangePicker.js";
|
|
15
|
-
import { MODES, ALL_TIME, RELATIVE, ABSOLUTE, RELATIVE_PRESETS, ABSOLUTE_PRESETS, CUSTOM_RANGE_KEY } from "./constants.js";
|
|
16
|
-
import relativeToAbsolute from "./dateUtils/relativeToAbsolute.js";
|
|
17
|
-
import toDateValue from "./dateUtils/toDateValue.js";
|
|
18
18
|
import { normalizeRange, getDefaultTexts } from "./utils.js";
|
|
19
19
|
import { toIsoString } from "@synerise/ds-core";
|
|
20
20
|
const isRelative = (dateRange) => {
|
|
@@ -215,7 +215,7 @@ const RawDateRangePicker = ({
|
|
|
215
215
|
}, [localValue]);
|
|
216
216
|
const addons = useMemo(() => {
|
|
217
217
|
const result = [];
|
|
218
|
-
if (showRelativePicker &&
|
|
218
|
+
if (showRelativePicker && relativeModes && relativeModes?.length > 0) {
|
|
219
219
|
const addonKey = "relative-picker";
|
|
220
220
|
const rangeTranslationKey = localValue?.translationKey;
|
|
221
221
|
result.push({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { findMatchingPreset } from "../../utils/findMatchingPreset.utils.js";
|
|
3
|
-
import "../../utils/setFuture.utils.js";
|
|
4
2
|
import { ALL_TIME } from "../../../constants.js";
|
|
3
|
+
import { findMatchingPreset } from "../../utils/findMatchingPreset.utils.js";
|
|
5
4
|
import "ramda/src/lensPath";
|
|
6
5
|
import "ramda/src/set";
|
|
6
|
+
import "../../utils/setFuture.utils.js";
|
|
7
7
|
import { Range } from "../../RelativeRangePicker.styles.js";
|
|
8
8
|
import { isLifetime } from "../RangeDropdown/RangeDropdown.js";
|
|
9
9
|
const RangeButtons = ({
|
|
@@ -8,10 +8,10 @@ import Scrollbar from "@synerise/ds-scrollbar";
|
|
|
8
8
|
import { useOnClickOutside } from "@synerise/ds-utils";
|
|
9
9
|
import { ALL_TIME } from "../../../constants.js";
|
|
10
10
|
import { OverlayWrapper, DropMenu, DropMenuItem, DropdownContainer, Range } from "../../RelativeRangePicker.styles.js";
|
|
11
|
-
import "../../utils/
|
|
11
|
+
import { findRangeByKey } from "../../utils/findRangeByKey.utils.js";
|
|
12
12
|
import "ramda/src/lensPath";
|
|
13
13
|
import "ramda/src/set";
|
|
14
|
-
import
|
|
14
|
+
import "../../utils/setFuture.utils.js";
|
|
15
15
|
const MAX_ITEMS_COUNT = 7;
|
|
16
16
|
const ITEMS_HEIGHT = 32;
|
|
17
17
|
const DROPDOWN_WIDTH = 160;
|
|
@@ -10,12 +10,12 @@ import RangeButtons from "./Elements/RangeButtons/RangeButtons.js";
|
|
|
10
10
|
import RangeDropdown from "./Elements/RangeDropdown/RangeDropdown.js";
|
|
11
11
|
import { Container, Ranges, Range } from "./RelativeRangePicker.styles.js";
|
|
12
12
|
import { findMatchingPreset } from "./utils/findMatchingPreset.utils.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { getCurrentGroupFromProps } from "./utils/getCurrentGroupFromProps.utils.js";
|
|
14
|
+
import { getDefaultCustomRange } from "./utils/getDefaultCustomRange.utils.js";
|
|
15
15
|
import { setDurationValue } from "./utils/setDurationValue.utils.js";
|
|
16
|
+
import { setFuture } from "./utils/setFuture.utils.js";
|
|
16
17
|
import { setOffsetValue } from "./utils/setOffsetValue.utils.js";
|
|
17
|
-
import {
|
|
18
|
-
import { getCurrentGroupFromProps } from "./utils/getCurrentGroupFromProps.utils.js";
|
|
18
|
+
import { updatePresetKey } from "./utils/updatePresetKey.utils.js";
|
|
19
19
|
const _RelativeRangePicker = class _RelativeRangePicker extends React.PureComponent {
|
|
20
20
|
constructor(props) {
|
|
21
21
|
super(props);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { findMatchingPreset } from './findMatchingPreset.utils';
|
|
2
|
-
export {
|
|
3
|
-
export { updatePresetKey } from './updatePresetKey.utils';
|
|
4
|
-
export { setDurationValue } from './setDurationValue.utils';
|
|
5
|
-
export { setOffsetValue } from './setOffsetValue.utils';
|
|
6
|
-
export { getDefaultCustomRange } from './getDefaultCustomRange.utils';
|
|
2
|
+
export { findRangeByKey } from './findRangeByKey.utils';
|
|
7
3
|
export { getCurrentGroupFromProps } from './getCurrentGroupFromProps.utils';
|
|
4
|
+
export { getDefaultCustomRange } from './getDefaultCustomRange.utils';
|
|
8
5
|
export { isAbsolute } from './isAbsolute.utils';
|
|
9
|
-
export {
|
|
6
|
+
export { setDurationValue } from './setDurationValue.utils';
|
|
7
|
+
export { setFuture } from './setFuture.utils';
|
|
8
|
+
export { setOffsetValue } from './setOffsetValue.utils';
|
|
9
|
+
export { updatePresetKey } from './updatePresetKey.utils';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { findMatchingPreset } from "./findMatchingPreset.utils.js";
|
|
2
|
-
import {
|
|
3
|
-
import { updatePresetKey } from "./updatePresetKey.utils.js";
|
|
4
|
-
import { setDurationValue } from "./setDurationValue.utils.js";
|
|
5
|
-
import { setOffsetValue } from "./setOffsetValue.utils.js";
|
|
6
|
-
import { getDefaultCustomRange } from "./getDefaultCustomRange.utils.js";
|
|
2
|
+
import { findRangeByKey } from "./findRangeByKey.utils.js";
|
|
7
3
|
import { getCurrentGroupFromProps } from "./getCurrentGroupFromProps.utils.js";
|
|
4
|
+
import { getDefaultCustomRange } from "./getDefaultCustomRange.utils.js";
|
|
8
5
|
import { isAbsolute } from "./isAbsolute.utils.js";
|
|
9
|
-
import {
|
|
6
|
+
import { setDurationValue } from "./setDurationValue.utils.js";
|
|
7
|
+
import { setFuture } from "./setFuture.utils.js";
|
|
8
|
+
import { setOffsetValue } from "./setOffsetValue.utils.js";
|
|
9
|
+
import { updatePresetKey } from "./updatePresetKey.utils.js";
|
|
10
10
|
export {
|
|
11
11
|
findMatchingPreset,
|
|
12
12
|
findRangeByKey,
|
package/dist/dateUtils/endOf.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { endOfYear, endOfMonth, endOfISOWeek, endOfDay, endOfSecond, endOfMinute, endOfHour } from "date-fns";
|
|
2
|
-
const
|
|
2
|
+
const endOf = {
|
|
3
3
|
HOURS: endOfHour,
|
|
4
4
|
MINUTES: endOfMinute,
|
|
5
5
|
SECONDS: endOfSecond,
|
|
@@ -9,5 +9,5 @@ const END_OF = {
|
|
|
9
9
|
YEARS: endOfYear
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
endOf as default
|
|
13
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { min, max } from "date-fns";
|
|
2
2
|
import ADD from "./add.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import endOf from "./endOf.js";
|
|
4
|
+
import startOf from "./startOf.js";
|
|
5
5
|
import toDateValue from "./toDateValue.js";
|
|
6
6
|
const relativeToAbsolute = (range) => {
|
|
7
7
|
const {
|
|
@@ -15,20 +15,20 @@ const relativeToAbsolute = (range) => {
|
|
|
15
15
|
if (future) {
|
|
16
16
|
left = toDateValue(
|
|
17
17
|
// @ts-expect-error - requires type refactor
|
|
18
|
-
ADD[offset.type](
|
|
18
|
+
ADD[offset.type](startOf[offset.type](now), offset.value)
|
|
19
19
|
);
|
|
20
20
|
right = toDateValue(
|
|
21
21
|
// @ts-expect-error - requires type refactor
|
|
22
|
-
ADD[duration.type](
|
|
22
|
+
ADD[duration.type](endOf[duration.type](left), duration.value - 1)
|
|
23
23
|
);
|
|
24
24
|
} else {
|
|
25
25
|
right = toDateValue(
|
|
26
26
|
// @ts-expect-error - requires type refactor
|
|
27
|
-
ADD[offset.type](
|
|
27
|
+
ADD[offset.type](endOf[offset.type](now), -offset.value)
|
|
28
28
|
);
|
|
29
29
|
left = toDateValue(
|
|
30
30
|
// @ts-expect-error - requires type refactor
|
|
31
|
-
ADD[duration.type](
|
|
31
|
+
ADD[duration.type](startOf[duration.type](right), 1 - duration.value)
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
const from = min([left, right]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { startOfYear, startOfMonth, startOfISOWeek, startOfDay, startOfSecond, startOfMinute, startOfHour } from "date-fns";
|
|
2
|
-
const
|
|
2
|
+
const startOf = {
|
|
3
3
|
HOURS: startOfHour,
|
|
4
4
|
MINUTES: startOfMinute,
|
|
5
5
|
SECONDS: startOfSecond,
|
|
@@ -9,5 +9,5 @@ const START_OF = {
|
|
|
9
9
|
YEARS: startOfYear
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
startOf as default
|
|
13
13
|
};
|
package/dist/fns.d.ts
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
1
|
import { addDays as fnsAddDays, addHours as fnsAddHours, addMinutes as fnsAddMinutes, addMonths as fnsAddMonths, addSeconds as fnsAddSeconds, addWeeks as fnsAddWeeks, addYears as fnsAddYears, endOfDay as fnsEndOfDay, endOfMonth as fnsEndOfMonth, format as fnsFormat, getYear as fnsGetYear, isAfter as fnsIsAfter, isBefore as fnsIsBefore, isSameMonth as fnsIsSameMonth, isSameYear as fnsIsSameYear, setDate as fnsSetDate, setMonth as fnsSetMonth, setYear as fnsSetYear, startOfDay as fnsStartOfDay, startOfMonth as fnsStartOfMonth } from 'date-fns';
|
|
2
|
-
export { fnsAddSeconds };
|
|
3
|
-
export { fnsAddMinutes };
|
|
4
|
-
export { fnsAddWeeks };
|
|
5
|
-
export { fnsAddHours };
|
|
6
|
-
export { fnsAddDays };
|
|
7
|
-
export { fnsStartOfMonth };
|
|
8
|
-
export { fnsSetDate };
|
|
9
|
-
export { fnsSetMonth };
|
|
10
|
-
export { fnsSetYear };
|
|
11
|
-
export { fnsStartOfDay };
|
|
12
|
-
export { fnsEndOfDay };
|
|
13
|
-
export { fnsAddYears };
|
|
14
|
-
export { fnsEndOfMonth };
|
|
15
|
-
export { fnsIsSameMonth };
|
|
16
|
-
export { fnsIsBefore };
|
|
17
|
-
export { fnsIsAfter };
|
|
18
|
-
export { fnsAddMonths };
|
|
19
|
-
export { fnsFormat };
|
|
20
|
-
export { fnsIsSameYear };
|
|
21
|
-
export { fnsGetYear };
|
|
2
|
+
export { fnsAddDays, fnsAddHours, fnsAddMinutes, fnsAddMonths, fnsAddSeconds, fnsAddWeeks, fnsAddYears, fnsEndOfDay, fnsEndOfMonth, fnsFormat, fnsGetYear, fnsIsAfter, fnsIsBefore, fnsIsSameMonth, fnsIsSameYear, fnsSetDate, fnsSetMonth, fnsSetYear, fnsStartOfDay, fnsStartOfMonth, };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
export * as CONST from './constants';
|
|
2
|
+
export { default } from './DateRangePicker';
|
|
3
|
+
export type { DateRangePickerProps, Texts as DateRangePickerTexts, } from './DateRangePicker.types';
|
|
4
|
+
export type { AbsoluteDateRange, AbsoluteDateRangePreset, DateFilter, DateRange, DateRangePreset, RelativeDateRange, RelativeDateRangePreset, RelativeUnits, } from './date.types';
|
|
5
|
+
export { fnsFormat } from './fns';
|
|
6
|
+
export { DEFAULT_RANGE_END, DEFAULT_RANGE_START, } from './RangeFilter/constants';
|
|
7
|
+
export { default as MonthlyDateFilter } from './RangeFilter/Filters/MonthlyFilter/MonthlyFilter';
|
|
1
8
|
export { default as DailyDateFilter } from './RangeFilter/Filters/new/Daily/Daily';
|
|
2
9
|
export { default as WeeklyDateFilter } from './RangeFilter/Filters/new/Weekly/Weekly';
|
|
3
|
-
export {
|
|
10
|
+
export type { DayOfWeekIndex, WeeklyProps, WeeklySchedule, WeeklyScheduleDayValue, } from './RangeFilter/Filters/new/Weekly/Weekly.types';
|
|
4
11
|
export { default as TimeWindow } from './RangeFilter/Shared/TimeWindow/TimeWindow';
|
|
12
|
+
export { getDisabledTimeOptions } from './RangePicker/utils';
|
|
5
13
|
export { RawDateRangePicker } from './RawDateRangePicker';
|
|
6
14
|
export * as utils from './utils';
|
|
7
|
-
export * as CONST from './constants';
|
|
8
|
-
export { default } from './DateRangePicker';
|
|
9
|
-
export { fnsFormat } from './fns';
|
|
10
|
-
export type { WeeklyProps, WeeklyScheduleDayValue, WeeklySchedule, DayOfWeekIndex, } from './RangeFilter/Filters/new/Weekly/Weekly.types';
|
|
11
|
-
export { getDisabledTimeOptions } from './RangePicker/utils';
|
|
12
|
-
export type { AbsoluteDateRange, RelativeDateRange, DateRange, DateRangePreset, RelativeDateRangePreset, AbsoluteDateRangePreset, DateFilter, RelativeUnits, } from './date.types';
|
|
13
|
-
export type { DateRangePickerProps, Texts as DateRangePickerTexts, } from './DateRangePicker.types';
|
|
14
|
-
export { DEFAULT_RANGE_END, DEFAULT_RANGE_START, } from './RangeFilter/constants';
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { default as default2 } from "./RangeFilter/Filters/new/Daily/Daily.js";
|
|
2
|
-
import { default as default3 } from "./RangeFilter/Filters/new/Weekly/Weekly.js";
|
|
3
|
-
import { default as default4 } from "./RangeFilter/Filters/MonthlyFilter/MonthlyFilter.js";
|
|
4
|
-
import { default as default5 } from "./RangeFilter/Shared/TimeWindow/TimeWindow.js";
|
|
5
|
-
import { RawDateRangePicker } from "./RawDateRangePicker.js";
|
|
6
|
-
import * as utils from "./utils.js";
|
|
7
1
|
import * as constants from "./constants.js";
|
|
8
|
-
import { default as
|
|
2
|
+
import { default as default2 } from "./DateRangePicker.js";
|
|
9
3
|
import { format } from "date-fns";
|
|
10
|
-
import { getDisabledTimeOptions } from "./RangePicker/utils.js";
|
|
11
4
|
import { DEFAULT_RANGE_END, DEFAULT_RANGE_START } from "./RangeFilter/constants.js";
|
|
5
|
+
import { default as default3 } from "./RangeFilter/Filters/MonthlyFilter/MonthlyFilter.js";
|
|
6
|
+
import { default as default4 } from "./RangeFilter/Filters/new/Daily/Daily.js";
|
|
7
|
+
import { default as default5 } from "./RangeFilter/Filters/new/Weekly/Weekly.js";
|
|
8
|
+
import { default as default6 } from "./RangeFilter/Shared/TimeWindow/TimeWindow.js";
|
|
9
|
+
import { getDisabledTimeOptions } from "./RangePicker/utils.js";
|
|
10
|
+
import { RawDateRangePicker } from "./RawDateRangePicker.js";
|
|
11
|
+
import * as utils from "./utils.js";
|
|
12
12
|
export {
|
|
13
13
|
constants as CONST,
|
|
14
14
|
DEFAULT_RANGE_END,
|
|
15
15
|
DEFAULT_RANGE_START,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
default4 as DailyDateFilter,
|
|
17
|
+
default3 as MonthlyDateFilter,
|
|
18
18
|
RawDateRangePicker,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
default6 as TimeWindow,
|
|
20
|
+
default5 as WeeklyDateFilter,
|
|
21
|
+
default2 as default,
|
|
22
22
|
format as fnsFormat,
|
|
23
23
|
getDisabledTimeOptions,
|
|
24
24
|
utils
|
package/dist/utils.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Texts } from './DateRangePicker.types';
|
|
|
3
3
|
import { DateRange } from './date.types';
|
|
4
4
|
import { default as END_OF } from './dateUtils/endOf';
|
|
5
5
|
import { default as START_OF } from './dateUtils/startOf';
|
|
6
|
-
export { START_OF, END_OF };
|
|
7
6
|
/**
|
|
8
7
|
* Re-exported rather than implemented here. This package used to carry its own copy, which took
|
|
9
8
|
* `Math.abs(offset) % 60` of an offset in *milliseconds* — so every zone that is not a whole number
|
|
@@ -14,6 +13,7 @@ export { START_OF, END_OF };
|
|
|
14
13
|
* Kept exported because `utils` is part of this package's public surface (`export * as utils`).
|
|
15
14
|
*/
|
|
16
15
|
export { toIsoString } from '@synerise/ds-core';
|
|
16
|
+
export { END_OF, START_OF };
|
|
17
17
|
export declare function toIsoStringWithoutZone(date: Date): string;
|
|
18
18
|
export declare const normalizeRange: (range: DateRange) => DateRange;
|
|
19
19
|
export declare const getDefaultTexts: (intl: IntlShape, disableDefault?: boolean, texts?: Partial<Texts>) => Texts;
|
package/dist/utils.js
CHANGED
|
@@ -2,8 +2,8 @@ import { min, max } from "date-fns";
|
|
|
2
2
|
import omit from "lodash.omit";
|
|
3
3
|
import { ABSOLUTE, RELATIVE, CUSTOM_RANGE_KEY } from "./constants.js";
|
|
4
4
|
import ADD from "./dateUtils/add.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import endOf from "./dateUtils/endOf.js";
|
|
6
|
+
import startOf from "./dateUtils/startOf.js";
|
|
7
7
|
import { toIsoString } from "@synerise/ds-core";
|
|
8
8
|
const rmvTZOffset = (dateString) => {
|
|
9
9
|
const date = dateString.toString();
|
|
@@ -45,11 +45,11 @@ const normalizeRange = (range) => {
|
|
|
45
45
|
rightBoundaryRoundingUnit = unitGranularityOrder.indexOf(duration.type) < unitGranularityOrder.indexOf(offset.type) ? duration.type : offset.type;
|
|
46
46
|
}
|
|
47
47
|
if (future) {
|
|
48
|
-
left = ADD[offset.type](
|
|
49
|
-
right =
|
|
48
|
+
left = ADD[offset.type](startOf[offset.type](now), offset.value);
|
|
49
|
+
right = endOf[duration.type](ADD[duration.type](left, duration.value - 1));
|
|
50
50
|
} else {
|
|
51
|
-
right =
|
|
52
|
-
left = ADD[duration.type](
|
|
51
|
+
right = endOf[rightBoundaryRoundingUnit](ADD[offset.type](now, -offset.value));
|
|
52
|
+
left = ADD[duration.type](startOf[duration.type](right), 1 - duration.value);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
const from = min([left, right]);
|
|
@@ -188,8 +188,8 @@ const DEFAULT_RANGE = normalizeRange({
|
|
|
188
188
|
});
|
|
189
189
|
export {
|
|
190
190
|
DEFAULT_RANGE,
|
|
191
|
-
END_OF,
|
|
192
|
-
START_OF,
|
|
191
|
+
endOf as END_OF,
|
|
192
|
+
startOf as START_OF,
|
|
193
193
|
getDefaultTexts,
|
|
194
194
|
normalizeRange,
|
|
195
195
|
toIsoString,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-date-range-picker",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "Date-Range-Picker UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -42,26 +42,26 @@
|
|
|
42
42
|
],
|
|
43
43
|
"types": "dist/index.d.ts",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@synerise/ds-badge": "^2.0.
|
|
46
|
-
"@synerise/ds-button": "^2.0
|
|
47
|
-
"@synerise/ds-button-group": "^2.0.
|
|
48
|
-
"@synerise/ds-date-picker": "^2.1.
|
|
49
|
-
"@synerise/ds-dropdown": "^2.1.
|
|
50
|
-
"@synerise/ds-form-field": "^2.0.
|
|
51
|
-
"@synerise/ds-icon": "^2.1.
|
|
52
|
-
"@synerise/ds-inline-edit": "^2.0.
|
|
53
|
-
"@synerise/ds-input": "^2.0.
|
|
54
|
-
"@synerise/ds-input-number": "^2.0.
|
|
55
|
-
"@synerise/ds-list-item": "^2.1.
|
|
56
|
-
"@synerise/ds-manageable-list": "^2.1.
|
|
57
|
-
"@synerise/ds-popover": "^2.0.
|
|
58
|
-
"@synerise/ds-scrollbar": "^2.0.
|
|
59
|
-
"@synerise/ds-select": "^2.1.
|
|
60
|
-
"@synerise/ds-slider": "^2.0.
|
|
61
|
-
"@synerise/ds-tag": "^2.0.
|
|
62
|
-
"@synerise/ds-time-picker": "^2.0.
|
|
63
|
-
"@synerise/ds-tooltip": "^2.0.
|
|
64
|
-
"@synerise/ds-utils": "^2.
|
|
45
|
+
"@synerise/ds-badge": "^2.0.5",
|
|
46
|
+
"@synerise/ds-button": "^2.1.0",
|
|
47
|
+
"@synerise/ds-button-group": "^2.0.5",
|
|
48
|
+
"@synerise/ds-date-picker": "^2.1.3",
|
|
49
|
+
"@synerise/ds-dropdown": "^2.1.2",
|
|
50
|
+
"@synerise/ds-form-field": "^2.0.5",
|
|
51
|
+
"@synerise/ds-icon": "^2.1.3",
|
|
52
|
+
"@synerise/ds-inline-edit": "^2.0.6",
|
|
53
|
+
"@synerise/ds-input": "^2.0.6",
|
|
54
|
+
"@synerise/ds-input-number": "^2.0.6",
|
|
55
|
+
"@synerise/ds-list-item": "^2.1.2",
|
|
56
|
+
"@synerise/ds-manageable-list": "^2.1.3",
|
|
57
|
+
"@synerise/ds-popover": "^2.0.3",
|
|
58
|
+
"@synerise/ds-scrollbar": "^2.0.4",
|
|
59
|
+
"@synerise/ds-select": "^2.1.2",
|
|
60
|
+
"@synerise/ds-slider": "^2.0.5",
|
|
61
|
+
"@synerise/ds-tag": "^2.0.5",
|
|
62
|
+
"@synerise/ds-time-picker": "^2.0.6",
|
|
63
|
+
"@synerise/ds-tooltip": "^2.0.5",
|
|
64
|
+
"@synerise/ds-utils": "^2.2.0",
|
|
65
65
|
"date-fns": "^4.1.0",
|
|
66
66
|
"dayjs": "^1.8.35",
|
|
67
67
|
"lodash.clonedeep": "^4.5.0",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
101
101
|
"styled-components": "^5.3.3"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "5e795fa4fd23f6b07277edb517a84bb9b5b6d256"
|
|
104
104
|
}
|