@synerise/ds-core 1.5.1 → 1.5.2

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.
Files changed (97) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +181 -0
  3. package/dist/i18n/es.json +0 -1
  4. package/dist/i18n/index.d.ts +1 -1
  5. package/dist/js/DSProvider/DSProvider.d.ts +2 -2
  6. package/dist/js/DSProvider/DSProvider.js +2 -2
  7. package/dist/js/DSProvider/LocaleProvider/LocaleProvider.utils.d.ts +1 -1
  8. package/dist/js/DSProvider/ThemeProvider/breakpoints.d.ts +5 -1
  9. package/dist/js/data-format/components/FormattedDate.d.ts +9 -0
  10. package/dist/js/data-format/components/FormattedDate.js +9 -0
  11. package/dist/js/data-format/components/FormattedDateTime.d.ts +9 -0
  12. package/dist/js/data-format/components/FormattedDateTime.js +13 -0
  13. package/dist/js/data-format/components/FormattedNumber.d.ts +7 -0
  14. package/dist/js/data-format/components/FormattedNumber.js +9 -0
  15. package/dist/js/data-format/components/FormattedRelativeDateTime.d.ts +10 -0
  16. package/dist/js/data-format/components/FormattedRelativeDateTime.js +24 -0
  17. package/dist/js/data-format/components/FormattedTime.d.ts +9 -0
  18. package/dist/js/data-format/components/FormattedTime.js +13 -0
  19. package/dist/js/data-format/components/index.d.ts +5 -0
  20. package/dist/js/data-format/components/index.js +5 -0
  21. package/dist/js/data-format/constants/dataFormat.constants.d.ts +36 -0
  22. package/dist/js/data-format/constants/dataFormat.constants.js +52 -0
  23. package/dist/js/data-format/constants/dataFormatConfig.constants.d.ts +7 -0
  24. package/dist/js/data-format/constants/dataFormatConfig.constants.js +14 -0
  25. package/dist/js/data-format/constants/dateTimeParts.constants.d.ts +5 -0
  26. package/dist/js/data-format/constants/dateTimeParts.constants.js +4 -0
  27. package/dist/js/data-format/constants/index.d.ts +3 -0
  28. package/dist/js/data-format/constants/index.js +3 -0
  29. package/dist/js/data-format/contexts/DataFormatConfigContext.d.ts +2 -0
  30. package/dist/js/data-format/contexts/DataFormatConfigContext.js +3 -0
  31. package/dist/js/data-format/contexts/DataFormatIntlsContext.d.ts +2 -0
  32. package/dist/js/data-format/contexts/DataFormatIntlsContext.js +7 -0
  33. package/dist/js/data-format/contexts/index.d.ts +2 -0
  34. package/dist/js/data-format/contexts/index.js +2 -0
  35. package/dist/js/data-format/hocs/withDataFormat.d.ts +4 -0
  36. package/dist/js/data-format/hocs/withDataFormat.js +10 -0
  37. package/dist/js/data-format/hooks/index.d.ts +5 -0
  38. package/dist/js/data-format/hooks/index.js +5 -0
  39. package/dist/js/data-format/hooks/useDataFormat.d.ts +12 -0
  40. package/dist/js/data-format/hooks/useDataFormat.js +96 -0
  41. package/dist/js/data-format/hooks/useDataFormatConfig.d.ts +2 -0
  42. package/dist/js/data-format/hooks/useDataFormatConfig.js +5 -0
  43. package/dist/js/data-format/hooks/useDataFormatIntls.d.ts +2 -0
  44. package/dist/js/data-format/hooks/useDataFormatIntls.js +5 -0
  45. package/dist/js/data-format/hooks/useDataFormatUtils.d.ts +16 -0
  46. package/dist/js/data-format/hooks/useDataFormatUtils.js +113 -0
  47. package/dist/js/data-format/hooks/useSingleIntl.d.ts +4 -0
  48. package/dist/js/data-format/hooks/useSingleIntl.js +12 -0
  49. package/dist/js/data-format/index.d.ts +8 -0
  50. package/dist/js/data-format/index.js +7 -0
  51. package/dist/js/data-format/providers/DataFormatConfigProvider.d.ts +7 -0
  52. package/dist/js/data-format/providers/DataFormatConfigProvider.js +26 -0
  53. package/dist/js/data-format/types/dataFormat.types.d.ts +42 -0
  54. package/dist/js/data-format/types/dataFormat.types.js +5 -0
  55. package/dist/js/data-format/types/dataFormatConfig.types.d.ts +16 -0
  56. package/dist/js/data-format/types/dataFormatConfig.types.js +2 -0
  57. package/dist/js/data-format/types/dateTimeParts.types.d.ts +3 -0
  58. package/dist/js/data-format/types/dateTimeParts.types.js +2 -0
  59. package/dist/js/data-format/types/index.d.ts +3 -0
  60. package/dist/js/data-format/types/index.js +1 -0
  61. package/dist/js/data-format/utils/dataFormat.utils.d.ts +16 -0
  62. package/dist/js/data-format/utils/dataFormat.utils.js +119 -0
  63. package/dist/js/data-format/utils/dataFormatConfig.utils.d.ts +2 -0
  64. package/dist/js/data-format/utils/dataFormatConfig.utils.js +8 -0
  65. package/dist/js/data-format/utils/date.utils.d.ts +8 -0
  66. package/dist/js/data-format/utils/date.utils.js +50 -0
  67. package/dist/js/data-format/utils/dateTimeParts.utils.d.ts +14 -0
  68. package/dist/js/data-format/utils/dateTimeParts.utils.js +86 -0
  69. package/dist/js/data-format/utils/index.d.ts +5 -0
  70. package/dist/js/data-format/utils/index.js +5 -0
  71. package/dist/js/data-format/utils/timeZone.utils.d.ts +16 -0
  72. package/dist/js/data-format/utils/timeZone.utils.js +94 -0
  73. package/dist/js/index.d.ts +3 -0
  74. package/dist/js/index.js +4 -1
  75. package/dist/js/mediaQuery/mediaQuery.d.ts +1 -5
  76. package/dist/js/testing/index.d.ts +2 -0
  77. package/dist/js/testing/index.js +2 -0
  78. package/dist/js/testing/renderWithProvider/renderWithProvider.d.ts +10 -0
  79. package/dist/js/testing/renderWithProvider/renderWithProvider.js +28 -0
  80. package/dist/js/testing/renderWithProvider/renderWithProvider.spec.d.ts +1 -0
  81. package/dist/js/testing/sleep.d.ts +1 -0
  82. package/dist/js/testing/sleep.js +8 -0
  83. package/dist/js/toaster/Toaster.d.ts +2 -0
  84. package/dist/js/toaster/Toaster.js +8 -0
  85. package/dist/js/toaster/Toaster.types.d.ts +1 -0
  86. package/dist/js/toaster/Toaster.types.js +1 -0
  87. package/dist/js/toaster/constants.d.ts +2 -0
  88. package/dist/js/toaster/constants.js +8 -0
  89. package/dist/js/toaster/contexts/ToasterContext.d.ts +6 -0
  90. package/dist/js/toaster/contexts/ToasterContext.js +6 -0
  91. package/dist/js/toaster/hooks/useToaster.d.ts +1 -0
  92. package/dist/js/toaster/hooks/useToaster.js +5 -0
  93. package/dist/js/toaster/index.d.ts +6 -0
  94. package/dist/js/toaster/index.js +5 -0
  95. package/dist/js/toaster/providers/ToasterProvider.d.ts +6 -0
  96. package/dist/js/toaster/providers/ToasterProvider.js +17 -0
  97. package/package.json +14 -7
@@ -0,0 +1,96 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import { isDayjs } from 'dayjs';
3
+ import moment from 'moment';
4
+ import { useCallback, useMemo } from 'react';
5
+ import { DATE_CONSTANTS_TARGET_FORMATS } from '../constants';
6
+ import { getConstantDatesAndFormattingOptions } from '../utils';
7
+ import { isValidDate } from '../utils/date.utils';
8
+ import { useDataFormatConfig } from './useDataFormatConfig';
9
+ import { useDataFormatIntls } from './useDataFormatIntls';
10
+ import { useDataFormatUtils } from './useDataFormatUtils';
11
+ export var useDataFormat = function useDataFormat() {
12
+ var _useDataFormatIntls = useDataFormatIntls(),
13
+ numberFormatIntl = _useDataFormatIntls.numberFormatIntl,
14
+ timeFormatIntl = _useDataFormatIntls.timeFormatIntl,
15
+ dateFormatIntl = _useDataFormatIntls.dateFormatIntl;
16
+ var _useDataFormatConfig = useDataFormatConfig(),
17
+ startWeekDayNotation = _useDataFormatConfig.startWeekDayNotation,
18
+ timeFormatNotation = _useDataFormatConfig.timeFormatNotation,
19
+ numberFormatNotation = _useDataFormatConfig.numberFormatNotation;
20
+ var _useDataFormatUtils = useDataFormatUtils(),
21
+ getFirstDayOfWeekFromNotation = _useDataFormatUtils.getFirstDayOfWeekFromNotation,
22
+ getIs12HoursClockFromNotation = _useDataFormatUtils.getIs12HoursClockFromNotation,
23
+ getFormattedNumber = _useDataFormatUtils.getFormattedNumber,
24
+ getFormattedDate = _useDataFormatUtils.getFormattedDate,
25
+ getFormattedDateFromMoment = _useDataFormatUtils.getFormattedDateFromMoment,
26
+ getFormattedDateFromDayjs = _useDataFormatUtils.getFormattedDateFromDayjs,
27
+ getFormattedValueUsingCommonOptions = _useDataFormatUtils.getFormattedValueUsingCommonOptions,
28
+ getThousandDelimiterFromNotation = _useDataFormatUtils.getThousandDelimiterFromNotation,
29
+ getDecimalDelimiterFromNotation = _useDataFormatUtils.getDecimalDelimiterFromNotation;
30
+ var firstDayOfWeek = useMemo(function () {
31
+ return getFirstDayOfWeekFromNotation(startWeekDayNotation);
32
+ }, [startWeekDayNotation, getFirstDayOfWeekFromNotation]);
33
+ var isSundayFirstWeekDay = useMemo(function () {
34
+ return firstDayOfWeek === 0;
35
+ }, [firstDayOfWeek]);
36
+ var is12HoursClock = useMemo(function () {
37
+ return getIs12HoursClockFromNotation(timeFormatNotation);
38
+ }, [timeFormatNotation, getIs12HoursClockFromNotation]);
39
+ var formatValue = useCallback(
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+ function (value, options) {
42
+ var result = '';
43
+ if (value instanceof moment) {
44
+ result = getFormattedDateFromMoment(value, dateFormatIntl, timeFormatIntl, options);
45
+ }
46
+ if (isDayjs(value)) {
47
+ result = getFormattedDateFromDayjs(value, dateFormatIntl, timeFormatIntl, options);
48
+ }
49
+ if (value instanceof Date) {
50
+ if (!isValidDate(value)) {
51
+ console.warn('invalid date', value);
52
+ return value.toString();
53
+ }
54
+ result = getFormattedDate(value, dateFormatIntl, timeFormatIntl, options);
55
+ }
56
+ if (typeof value === 'number') {
57
+ result = getFormattedNumber(value, numberFormatIntl, options);
58
+ }
59
+ if (typeof value === 'string') {
60
+ result = value;
61
+ }
62
+ return getFormattedValueUsingCommonOptions(result, options);
63
+ }, [numberFormatIntl, dateFormatIntl, timeFormatIntl, getFormattedDate, getFormattedDateFromMoment, getFormattedNumber, getFormattedDateFromDayjs, getFormattedValueUsingCommonOptions]);
64
+ var formatMultipleValues = useCallback(
65
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
+ function (values, options) {
67
+ return values.map(function (value) {
68
+ return formatValue(value, options);
69
+ });
70
+ }, [formatValue]);
71
+ var getConstants = useCallback(function (targetFormat, options, customStartDate, customEndDate, interval) {
72
+ if (DATE_CONSTANTS_TARGET_FORMATS.includes(targetFormat)) {
73
+ var _getConstantDatesAndF = getConstantDatesAndFormattingOptions(targetFormat, isSundayFirstWeekDay, customStartDate, customEndDate, interval),
74
+ constantDates = _getConstantDatesAndF.constantDates,
75
+ defaultOptions = _getConstantDatesAndF.defaultOptions;
76
+ return formatMultipleValues(constantDates, _extends({}, defaultOptions, options));
77
+ }
78
+ return undefined;
79
+ }, [formatMultipleValues, isSundayFirstWeekDay]);
80
+ var thousandDelimiter = useMemo(function () {
81
+ return getThousandDelimiterFromNotation(numberFormatNotation);
82
+ }, [numberFormatNotation, getThousandDelimiterFromNotation]);
83
+ var decimalDelimiter = useMemo(function () {
84
+ return getDecimalDelimiterFromNotation(numberFormatNotation);
85
+ }, [numberFormatNotation, getDecimalDelimiterFromNotation]);
86
+ return {
87
+ firstDayOfWeek: firstDayOfWeek,
88
+ isSundayFirstWeekDay: isSundayFirstWeekDay,
89
+ is12HoursClock: is12HoursClock,
90
+ formatValue: formatValue,
91
+ formatMultipleValues: formatMultipleValues,
92
+ getConstants: getConstants,
93
+ thousandDelimiter: thousandDelimiter,
94
+ decimalDelimiter: decimalDelimiter
95
+ };
96
+ };
@@ -0,0 +1,2 @@
1
+ import { type DataFormatConfig } from '../types';
2
+ export declare const useDataFormatConfig: () => DataFormatConfig;
@@ -0,0 +1,5 @@
1
+ import { useContext } from 'react';
2
+ import { DataFormatConfigContext } from '../contexts';
3
+ export var useDataFormatConfig = function useDataFormatConfig() {
4
+ return useContext(DataFormatConfigContext);
5
+ };
@@ -0,0 +1,2 @@
1
+ import { type DataFormatIntls } from '../types';
2
+ export declare const useDataFormatIntls: () => DataFormatIntls;
@@ -0,0 +1,5 @@
1
+ import { useContext } from 'react';
2
+ import { DataFormatIntlsContext } from '../contexts';
3
+ export var useDataFormatIntls = function useDataFormatIntls() {
4
+ return useContext(DataFormatIntlsContext);
5
+ };
@@ -0,0 +1,16 @@
1
+ import { type Dayjs } from 'dayjs';
2
+ import { type Moment } from 'moment';
3
+ import { type IntlShape } from 'react-intl';
4
+ import { type CommonFormatOptions, type DataFormatNotationType, type DateToFormatOptions, type Delimiter, type NumberToFormatOptions } from '../types';
5
+ export declare const useDataFormatUtils: () => {
6
+ getLocaleFromNotation: (notation?: DataFormatNotationType) => string;
7
+ getFirstDayOfWeekFromNotation: (notation?: DataFormatNotationType) => number;
8
+ getIs12HoursClockFromNotation: (notation?: DataFormatNotationType) => boolean;
9
+ getFormattedNumber: (value: number, numberFormatIntl: IntlShape, options?: NumberToFormatOptions) => string;
10
+ getFormattedDate: (value: Date, dateFormatIntl: IntlShape, timeFormatIntl: IntlShape, options?: DateToFormatOptions) => string;
11
+ getFormattedDateFromMoment: (value: Moment, dateFormatIntl: IntlShape, timeFormatIntl: IntlShape, options?: DateToFormatOptions) => string;
12
+ getFormattedDateFromDayjs: (value: Dayjs, dateFormatIntl: IntlShape, timeFormatIntl: IntlShape, options?: DateToFormatOptions) => string;
13
+ getFormattedValueUsingCommonOptions: (value: string, options?: CommonFormatOptions) => string;
14
+ getThousandDelimiterFromNotation: (notation?: DataFormatNotationType) => Delimiter;
15
+ getDecimalDelimiterFromNotation: (notation?: DataFormatNotationType) => Delimiter;
16
+ };
@@ -0,0 +1,113 @@
1
+ import dayjs from 'dayjs';
2
+ import moment from 'moment';
3
+ import { useCallback } from 'react';
4
+ import { useIntl } from 'react-intl';
5
+ import { DATE, DATETIME, EU_DECIMAL_DELIMITER, EU_NOTATION, EU_THOUSAND_DELIMITER, MONTH_LONG, MONTH_SHORT, RELATIVE_FROM, RELATIVE_FROM_WITHOUT_SUFFIX, RELATIVE_TO, RELATIVE_TO_WITHOUT_SUFFIX, TIME, US_DECIMAL_DELIMITER, US_NOTATION, US_THOUSAND_DELIMITER, WEEKDAY_LONG, WEEKDAY_SHORT } from '../constants';
6
+ import { addPrefix, addSuffix, changeNamingConvention, convertDateToDateString, convertDateToDateTimeString, convertDateToMonthLongString, convertDateToMonthShortString, convertDateToRelativeFromString, convertDateToRelativeToString, convertDateToTimeString, convertDateToWeekdayLongString, convertDateToWeekdayShortString, convertNumberString } from '../utils';
7
+ import { getLocalDateInTimeZone } from '../utils/timeZone.utils';
8
+ import { useDataFormatConfig } from './useDataFormatConfig';
9
+ export var useDataFormatUtils = function useDataFormatUtils() {
10
+ var languageIntl = useIntl();
11
+ var _useDataFormatConfig = useDataFormatConfig(),
12
+ numberFormatNotation = _useDataFormatConfig.numberFormatNotation,
13
+ applyTimeZoneOffset = _useDataFormatConfig.applyTimeZoneOffset;
14
+ var getLocaleFromNotation = useCallback(function (notation) {
15
+ switch (notation) {
16
+ case EU_NOTATION:
17
+ return 'pl';
18
+ case US_NOTATION:
19
+ return 'en-US';
20
+ default:
21
+ return 'pl';
22
+ }
23
+ }, []);
24
+ var getFirstDayOfWeekFromNotation = useCallback(function (notation) {
25
+ switch (notation) {
26
+ case EU_NOTATION:
27
+ return 1;
28
+ case US_NOTATION:
29
+ return 0;
30
+ default:
31
+ return 1;
32
+ }
33
+ }, []);
34
+ var getThousandDelimiterFromNotation = useCallback(function (notation) {
35
+ return notation === US_NOTATION ? US_THOUSAND_DELIMITER : EU_THOUSAND_DELIMITER;
36
+ }, []);
37
+ var getDecimalDelimiterFromNotation = useCallback(function (notation) {
38
+ return notation === US_NOTATION ? US_DECIMAL_DELIMITER : EU_DECIMAL_DELIMITER;
39
+ }, []);
40
+ var getIs12HoursClockFromNotation = useCallback(function (notation) {
41
+ return notation === US_NOTATION;
42
+ }, []);
43
+ var getFormattedNumber = useCallback(function (value, numberFormatIntl, options) {
44
+ var thousandDelimiter = getThousandDelimiterFromNotation(numberFormatNotation);
45
+ var decimalDelimiter = getDecimalDelimiterFromNotation(numberFormatNotation);
46
+ return convertNumberString(value, numberFormatIntl, languageIntl, thousandDelimiter, decimalDelimiter, options);
47
+ }, [languageIntl, numberFormatNotation, getThousandDelimiterFromNotation, getDecimalDelimiterFromNotation]);
48
+ var _useIntl = useIntl(),
49
+ globalTimeZone = _useIntl.timeZone;
50
+ var getFormattedDate = useCallback(function (value, dateFormatIntl, timeFormatIntl, options) {
51
+ var _value$toString;
52
+ var valueInTimezone = globalTimeZone && applyTimeZoneOffset ? getLocalDateInTimeZone(value.toISOString(), globalTimeZone) : value;
53
+ if ((options == null ? void 0 : options.targetFormat) === DATETIME) {
54
+ return convertDateToDateTimeString(valueInTimezone, dateFormatIntl, timeFormatIntl, languageIntl, options);
55
+ }
56
+ if ((options == null ? void 0 : options.targetFormat) === TIME) {
57
+ return convertDateToTimeString(valueInTimezone, timeFormatIntl, options);
58
+ }
59
+ if ((options == null ? void 0 : options.targetFormat) === RELATIVE_TO) {
60
+ return convertDateToRelativeToString(value);
61
+ }
62
+ if ((options == null ? void 0 : options.targetFormat) === RELATIVE_TO_WITHOUT_SUFFIX) {
63
+ return convertDateToRelativeToString(value, true);
64
+ }
65
+ if ((options == null ? void 0 : options.targetFormat) === RELATIVE_FROM) {
66
+ return convertDateToRelativeFromString(value);
67
+ }
68
+ if ((options == null ? void 0 : options.targetFormat) === RELATIVE_FROM_WITHOUT_SUFFIX) {
69
+ return convertDateToRelativeFromString(value, true);
70
+ }
71
+ if ((options == null ? void 0 : options.targetFormat) === WEEKDAY_LONG) {
72
+ return convertDateToWeekdayLongString(valueInTimezone, dateFormatIntl, languageIntl, options);
73
+ }
74
+ if ((options == null ? void 0 : options.targetFormat) === WEEKDAY_SHORT) {
75
+ return convertDateToWeekdayShortString(valueInTimezone, dateFormatIntl, languageIntl, options);
76
+ }
77
+ if ((options == null ? void 0 : options.targetFormat) === MONTH_LONG) {
78
+ return convertDateToMonthLongString(valueInTimezone, dateFormatIntl, languageIntl, options);
79
+ }
80
+ if ((options == null ? void 0 : options.targetFormat) === MONTH_SHORT) {
81
+ return convertDateToMonthShortString(valueInTimezone, dateFormatIntl, languageIntl, options);
82
+ }
83
+ if ((options == null ? void 0 : options.targetFormat) === DATE || !(options != null && options.targetFormat)) {
84
+ return convertDateToDateString(valueInTimezone, dateFormatIntl, languageIntl, options);
85
+ }
86
+ return (_value$toString = value == null ? void 0 : value.toString()) != null ? _value$toString : '';
87
+ }, [globalTimeZone, applyTimeZoneOffset, languageIntl]);
88
+ var getFormattedDateFromMoment = useCallback(function (value, dateFormatIntl, timeFormatIntl, options) {
89
+ return getFormattedDate(moment(value).toDate(), dateFormatIntl, timeFormatIntl, options);
90
+ }, [getFormattedDate]);
91
+ var getFormattedDateFromDayjs = useCallback(function (value, dateFormatIntl, timeFormatIntl, options) {
92
+ return getFormattedDate(dayjs(value).toDate(), dateFormatIntl, timeFormatIntl, options);
93
+ }, [getFormattedDate]);
94
+ var getFormattedValueUsingCommonOptions = useCallback(function (value, options) {
95
+ var result = value;
96
+ result = addPrefix(result, options);
97
+ result = addSuffix(result, options);
98
+ result = changeNamingConvention(result, options);
99
+ return result;
100
+ }, []);
101
+ return {
102
+ getLocaleFromNotation: getLocaleFromNotation,
103
+ getFirstDayOfWeekFromNotation: getFirstDayOfWeekFromNotation,
104
+ getIs12HoursClockFromNotation: getIs12HoursClockFromNotation,
105
+ getFormattedNumber: getFormattedNumber,
106
+ getFormattedDate: getFormattedDate,
107
+ getFormattedDateFromMoment: getFormattedDateFromMoment,
108
+ getFormattedDateFromDayjs: getFormattedDateFromDayjs,
109
+ getFormattedValueUsingCommonOptions: getFormattedValueUsingCommonOptions,
110
+ getThousandDelimiterFromNotation: getThousandDelimiterFromNotation,
111
+ getDecimalDelimiterFromNotation: getDecimalDelimiterFromNotation
112
+ };
113
+ };
@@ -0,0 +1,4 @@
1
+ import { type IntlShape } from 'react-intl';
2
+ export declare const useSingleIntl: (locale: string) => {
3
+ intl: IntlShape;
4
+ };
@@ -0,0 +1,12 @@
1
+ import { createIntl, createIntlCache, useIntl } from 'react-intl';
2
+ export var useSingleIntl = function useSingleIntl(locale) {
3
+ var cache = createIntlCache();
4
+ var globalIntl = useIntl();
5
+ var intl = createIntl({
6
+ locale: locale,
7
+ timeZone: globalIntl.timeZone
8
+ }, cache);
9
+ return {
10
+ intl: intl
11
+ };
12
+ };
@@ -0,0 +1,8 @@
1
+ export { DataFormatConfigProvider, type DataFormatConfigProviderProps, } from './providers/DataFormatConfigProvider';
2
+ export { FormattedDate, FormattedDateTime, FormattedNumber, FormattedTime, FormattedRelativeDateTimeFrom, FormattedRelativeDateTimeTo, } from './components';
3
+ export { useDataFormat, useDataFormatUtils, useDataFormatConfig, useDataFormatIntls, type UseDataFormatProps, } from './hooks';
4
+ export { withDataFormat, type WithDataFormatProps, } from './hocs/withDataFormat';
5
+ export { getDataFormatConfigFromNotation, getDefaultDataTimeOptions, } from './utils';
6
+ export * from './constants';
7
+ export { DataFormatConfigContext, DataFormatIntlsContext } from './contexts';
8
+ export type { DataFormatNotationType, NumberToFormatOptions, DateToFormatOptions, DataFormatConfig, Delimiter, DateTargetFormat, NumberTargetFormat, NamingConvention, DateToFormat, OverloadFormatValue, OverloadFormatMultipleValues, CommonFormatOptions, DateConstantsTargetFormat, OverloadGetConstants, DateTimePartFormat, DataFormatIntls, } from './types';
@@ -0,0 +1,7 @@
1
+ export { DataFormatConfigProvider } from './providers/DataFormatConfigProvider';
2
+ export { FormattedDate, FormattedDateTime, FormattedNumber, FormattedTime, FormattedRelativeDateTimeFrom, FormattedRelativeDateTimeTo } from './components';
3
+ export { useDataFormat, useDataFormatUtils, useDataFormatConfig, useDataFormatIntls } from './hooks';
4
+ export { withDataFormat } from './hocs/withDataFormat';
5
+ export { getDataFormatConfigFromNotation, getDefaultDataTimeOptions } from './utils';
6
+ export * from './constants';
7
+ export { DataFormatConfigContext, DataFormatIntlsContext } from './contexts';
@@ -0,0 +1,7 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import { type DataFormatConfig } from '../types';
3
+ export type DataFormatConfigProviderProps = {
4
+ dataFormatConfig?: DataFormatConfig;
5
+ children?: ReactNode;
6
+ };
7
+ export declare const DataFormatConfigProvider: ({ dataFormatConfig: dataFormatConfigFromProps, children, }: DataFormatConfigProviderProps) => React.JSX.Element;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { DEFAULT_DATA_FORMAT_CONFIG } from '../constants';
3
+ import { DataFormatConfigContext, DataFormatIntlsContext } from '../contexts';
4
+ import { useDataFormatUtils, useSingleIntl } from '../hooks';
5
+ export var DataFormatConfigProvider = function DataFormatConfigProvider(_ref) {
6
+ var dataFormatConfigFromProps = _ref.dataFormatConfig,
7
+ children = _ref.children;
8
+ var dataFormatConfig = dataFormatConfigFromProps != null ? dataFormatConfigFromProps : DEFAULT_DATA_FORMAT_CONFIG;
9
+ var _useDataFormatUtils = useDataFormatUtils(),
10
+ getLocaleFromNotation = _useDataFormatUtils.getLocaleFromNotation;
11
+ var _useSingleIntl = useSingleIntl(getLocaleFromNotation(dataFormatConfig == null ? void 0 : dataFormatConfig.numberFormatNotation)),
12
+ numberFormatIntl = _useSingleIntl.intl;
13
+ var _useSingleIntl2 = useSingleIntl(getLocaleFromNotation(dataFormatConfig == null ? void 0 : dataFormatConfig.dateFormatNotation)),
14
+ dateFormatIntl = _useSingleIntl2.intl;
15
+ var _useSingleIntl3 = useSingleIntl(getLocaleFromNotation(dataFormatConfig == null ? void 0 : dataFormatConfig.timeFormatNotation)),
16
+ timeFormatIntl = _useSingleIntl3.intl;
17
+ return /*#__PURE__*/React.createElement(DataFormatIntlsContext.Provider, {
18
+ value: {
19
+ numberFormatIntl: numberFormatIntl,
20
+ dateFormatIntl: dateFormatIntl,
21
+ timeFormatIntl: timeFormatIntl
22
+ }
23
+ }, /*#__PURE__*/React.createElement(DataFormatConfigContext.Provider, {
24
+ value: dataFormatConfig
25
+ }, children));
26
+ };
@@ -0,0 +1,42 @@
1
+ import { type Dayjs, type default as dayjs } from 'dayjs';
2
+ import { type Moment } from 'moment';
3
+ import { type FormatDateOptions, type FormatNumberOptions, type FormatPluralOptions } from 'react-intl';
4
+ declare const _DATE_TARGET_FORMATS: readonly ["date", "datetime", "relative-from", "relative-to", "relative-from-without-suffix", "relative-to-without-suffix", "time", "weekday-long", "weekday-short", "month-long", "month-short"];
5
+ export type DateTargetFormat = (typeof _DATE_TARGET_FORMATS)[number];
6
+ declare const _NUMBER_TARGET_FORMATS: readonly ["compact-larger-number", "compact-decimal-larger-number"];
7
+ export type NumberTargetFormat = (typeof _NUMBER_TARGET_FORMATS)[number];
8
+ declare const _NAMING_CONVENTIONS: readonly ["upperCase", "upperFirst", "lowerCase", "lowerFirst"];
9
+ export type NamingConvention = (typeof _NAMING_CONVENTIONS)[number];
10
+ export type DateConstantsTargetFormat = 'months-long' | 'months-short' | 'weekdays-long' | 'weekdays-short';
11
+ export type DateToFormat = Date | Moment | Dayjs;
12
+ export type CommonFormatOptions = {
13
+ prefix?: string;
14
+ suffix?: string;
15
+ namingConvention?: NamingConvention;
16
+ };
17
+ export type NumberToFormatOptions = FormatNumberOptions & CommonFormatOptions & {
18
+ pluralOptions?: FormatPluralOptions;
19
+ targetFormat?: NumberTargetFormat;
20
+ };
21
+ export type DateToFormatOptions = FormatDateOptions & CommonFormatOptions & {
22
+ dateOptions?: FormatDateOptions;
23
+ timeOptions?: FormatDateOptions;
24
+ targetFormat?: DateTargetFormat;
25
+ applyTimeZoneOffset?: boolean;
26
+ };
27
+ export type OverloadFormatValue = {
28
+ (value: number, options?: NumberToFormatOptions): string;
29
+ (value: Date | Moment | Dayjs, options?: DateToFormatOptions): string;
30
+ (value: string, options?: CommonFormatOptions): string;
31
+ };
32
+ export type OverloadFormatMultipleValues = {
33
+ (values: number[], options?: NumberToFormatOptions): string[];
34
+ (values: Date[] | Moment[] | Dayjs[], options?: DateToFormatOptions): string[];
35
+ (values: string[], options?: CommonFormatOptions): string[];
36
+ };
37
+ export type OverloadGetConstants = {
38
+ (targetFormat: DateConstantsTargetFormat, options?: DateToFormatOptions, customStartDate?: Date, customEndDate?: Date, customInterval?: dayjs.UnitType): string[] | undefined;
39
+ };
40
+ declare const _DELIMITERS: readonly [",", ".", " "];
41
+ export type Delimiter = (typeof _DELIMITERS)[number];
42
+ export {};
@@ -0,0 +1,5 @@
1
+ var _DATE_TARGET_FORMATS = ['date', 'datetime', 'relative-from', 'relative-to', 'relative-from-without-suffix', 'relative-to-without-suffix', 'time', 'weekday-long', 'weekday-short', 'month-long', 'month-short'];
2
+ var _NUMBER_TARGET_FORMATS = ['compact-larger-number', 'compact-decimal-larger-number'];
3
+ var _NAMING_CONVENTIONS = ['upperCase', 'upperFirst', 'lowerCase', 'lowerFirst'];
4
+ var _DELIMITERS = [',', '.', ' '];
5
+ export {};
@@ -0,0 +1,16 @@
1
+ import { type IntlShape } from 'react-intl';
2
+ declare const _DATA_FORMAT_NOTATION_TYPES: readonly ["US", "EU"];
3
+ export type DataFormatNotationType = (typeof _DATA_FORMAT_NOTATION_TYPES)[number];
4
+ export type DataFormatConfig = {
5
+ startWeekDayNotation?: DataFormatNotationType;
6
+ dateFormatNotation?: DataFormatNotationType;
7
+ timeFormatNotation?: DataFormatNotationType;
8
+ numberFormatNotation?: DataFormatNotationType;
9
+ applyTimeZoneOffset?: boolean;
10
+ };
11
+ export type DataFormatIntls = {
12
+ numberFormatIntl: IntlShape;
13
+ dateFormatIntl: IntlShape;
14
+ timeFormatIntl: IntlShape;
15
+ };
16
+ export {};
@@ -0,0 +1,2 @@
1
+ var _DATA_FORMAT_NOTATION_TYPES = ['US', 'EU'];
2
+ export {};
@@ -0,0 +1,3 @@
1
+ declare const _DATE_TIME_PART_FORMAT: readonly ["long", "short", "numeric"];
2
+ export type DateTimePartFormat = (typeof _DATE_TIME_PART_FORMAT)[number];
3
+ export {};
@@ -0,0 +1,2 @@
1
+ var _DATE_TIME_PART_FORMAT = ['long', 'short', 'numeric'];
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export type { NumberToFormatOptions, DateToFormatOptions, CommonFormatOptions, DateTargetFormat, NumberTargetFormat, NamingConvention, DateToFormat, OverloadFormatValue, OverloadFormatMultipleValues, OverloadGetConstants, Delimiter, DateConstantsTargetFormat, } from './dataFormat.types';
2
+ export type { DataFormatNotationType, DataFormatConfig, DataFormatIntls, } from './dataFormatConfig.types';
3
+ export type { DateTimePartFormat } from './dateTimeParts.types';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { type IntlShape } from 'react-intl';
2
+ import { type CommonFormatOptions, type DateToFormatOptions, type Delimiter, type NumberToFormatOptions } from '../types';
3
+ export declare const convertNumberString: (value: number, numberFormatIntl: IntlShape, languageIntl: IntlShape, thousandDelimiter: Delimiter, decimalDelimiter: Delimiter, numberOptions?: NumberToFormatOptions) => string;
4
+ export declare const convertDateToDateTimeString: (value: Date, dateFormatIntl: IntlShape, timeFormatIntl: IntlShape, languageIntl: IntlShape, options?: DateToFormatOptions) => string;
5
+ export declare const convertDateToRelativeToString: (value: Date, withoutSuffix?: boolean) => string;
6
+ export declare const convertDateToRelativeFromString: (value: Date, withoutSuffix?: boolean) => string;
7
+ export declare const convertDateToTimeString: (value: Date, timeFormatIntl: IntlShape, options?: DateToFormatOptions) => string;
8
+ export declare const convertDateToDateString: (value: Date, dateFormatIntl: IntlShape, languageIntl: IntlShape, options?: DateToFormatOptions) => string;
9
+ export declare const convertDateToWeekdayLongString: (value: Date, dateFormatIntl: IntlShape, languageIntl: IntlShape, options?: DateToFormatOptions) => string;
10
+ export declare const convertDateToWeekdayShortString: (value: Date, dateFormatIntl: IntlShape, languageIntl: IntlShape, options?: DateToFormatOptions) => string;
11
+ export declare const convertDateToMonthLongString: (value: Date, dateFormatIntl: IntlShape, languageIntl: IntlShape, options?: DateToFormatOptions) => string;
12
+ export declare const convertDateToMonthShortString: (value: Date, dateFormatIntl: IntlShape, languageIntl: IntlShape, options?: DateToFormatOptions) => string;
13
+ export declare const addPrefix: (value: string, options?: CommonFormatOptions) => string;
14
+ export declare const addSuffix: (value: string, options?: CommonFormatOptions) => string;
15
+ export declare const changeNamingConvention: (value: string, options?: CommonFormatOptions) => string;
16
+ export declare const getDefaultDataTimeOptions: (showTime?: boolean) => DateToFormatOptions;
@@ -0,0 +1,119 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import dayjs from 'dayjs';
3
+ import relativeTimePlugin from 'dayjs/plugin/relativeTime';
4
+ import { COMPACT_DECIMAL_LARGER_NUMBER, COMPACT_LARGER_NUMBER, DATE, DATETIME, DEFAULT_FORMAT_MONTH_SHORT_OPTIONS, DEFAULT_FORMAT_NUMBER_OPTIONS, LARGER_NUMBER_LIMIT, LOWER_CASE, LOWER_FIRST, UPPER_CASE, UPPER_FIRST } from '../constants';
5
+ import { dateTimePartsToString, getDateParts, getDateTimePartsSubset, getMonthLongDateParts, getMonthShortDateParts, getTimeParts, getWeekdayLongDateParts, getWeekdayShortDateParts, numberPartsToString, translateDateTimeParts } from './dateTimeParts.utils';
6
+ dayjs.extend(relativeTimePlugin);
7
+ export var convertNumberString = function convertNumberString(value, numberFormatIntl, languageIntl, thousandDelimiter, decimalDelimiter, numberOptions) {
8
+ var updatedNumberOptions = numberOptions;
9
+ if (updatedNumberOptions != null && updatedNumberOptions.pluralOptions) {
10
+ return numberFormatIntl.formatPlural(value, updatedNumberOptions);
11
+ }
12
+ if ((updatedNumberOptions == null ? void 0 : updatedNumberOptions.targetFormat) === COMPACT_LARGER_NUMBER && value > LARGER_NUMBER_LIMIT) {
13
+ if (!updatedNumberOptions.notation) {
14
+ updatedNumberOptions.notation = 'compact';
15
+ }
16
+ }
17
+ if ((updatedNumberOptions == null ? void 0 : updatedNumberOptions.targetFormat) === COMPACT_DECIMAL_LARGER_NUMBER && value > LARGER_NUMBER_LIMIT) {
18
+ if (!updatedNumberOptions.notation) {
19
+ updatedNumberOptions.notation = 'compact';
20
+ }
21
+ if (!updatedNumberOptions.minimumFractionDigits && updatedNumberOptions.minimumFractionDigits !== 0) {
22
+ updatedNumberOptions.minimumFractionDigits = 1;
23
+ }
24
+ }
25
+ var numberParts = languageIntl.formatNumberToParts(value, _extends({}, DEFAULT_FORMAT_NUMBER_OPTIONS, updatedNumberOptions));
26
+ return numberPartsToString(numberParts, thousandDelimiter, decimalDelimiter);
27
+ };
28
+ export var convertDateToDateTimeString = function convertDateToDateTimeString(value, dateFormatIntl, timeFormatIntl, languageIntl, options) {
29
+ var dateParts = getDateParts(value, dateFormatIntl, options == null ? void 0 : options.dateOptions);
30
+ var datePartsByLanguageIntl = getDateParts(value, languageIntl, options == null ? void 0 : options.dateOptions);
31
+ var translatedDateParts = translateDateTimeParts(dateParts, datePartsByLanguageIntl, options);
32
+ var date = dateTimePartsToString(translatedDateParts);
33
+ var time = dateTimePartsToString(getTimeParts(value, timeFormatIntl, options == null ? void 0 : options.timeOptions));
34
+ return date + ", " + time;
35
+ };
36
+ export var convertDateToRelativeToString = function convertDateToRelativeToString(value, withoutSuffix) {
37
+ return dayjs().to(dayjs(value), withoutSuffix);
38
+ };
39
+ export var convertDateToRelativeFromString = function convertDateToRelativeFromString(value, withoutSuffix) {
40
+ return dayjs().from(dayjs(value), withoutSuffix);
41
+ };
42
+ export var convertDateToTimeString = function convertDateToTimeString(value, timeFormatIntl, options) {
43
+ return dateTimePartsToString(getTimeParts(value, timeFormatIntl, options));
44
+ };
45
+ export var convertDateToDateString = function convertDateToDateString(value, dateFormatIntl, languageIntl, options) {
46
+ var dateParts = getDateParts(value, dateFormatIntl, options);
47
+ var datePartsByLanguageIntl = getDateParts(value, languageIntl, options);
48
+ var translatedDateParts = translateDateTimeParts(dateParts, datePartsByLanguageIntl, options);
49
+ return dateTimePartsToString(translatedDateParts);
50
+ };
51
+ export var convertDateToWeekdayLongString = function convertDateToWeekdayLongString(value, dateFormatIntl, languageIntl, options) {
52
+ var weekdayLongDateParts = getWeekdayLongDateParts(value, dateFormatIntl, options);
53
+ var weekdayLongDatePartsByLanguageIntl = getWeekdayLongDateParts(value, languageIntl, options);
54
+ var translatedDateTimeParts = translateDateTimeParts(weekdayLongDateParts, weekdayLongDatePartsByLanguageIntl, options);
55
+ var reducedDateTimeParts = getDateTimePartsSubset(translatedDateTimeParts, ['weekday']);
56
+ return dateTimePartsToString(reducedDateTimeParts);
57
+ };
58
+ export var convertDateToWeekdayShortString = function convertDateToWeekdayShortString(value, dateFormatIntl, languageIntl, options) {
59
+ var weekdayShortDateParts = getWeekdayShortDateParts(value, dateFormatIntl, options);
60
+ var weekdayShortDatePartsByLanguageIntl = getWeekdayShortDateParts(value, languageIntl, options);
61
+ var translatedDateTimeParts = translateDateTimeParts(weekdayShortDateParts, weekdayShortDatePartsByLanguageIntl, options);
62
+ var reducedDateTimeParts = getDateTimePartsSubset(translatedDateTimeParts, ['weekday']);
63
+ return dateTimePartsToString(reducedDateTimeParts);
64
+ };
65
+ export var convertDateToMonthLongString = function convertDateToMonthLongString(value, dateFormatIntl, languageIntl, options) {
66
+ var monthLongDateParts = getMonthLongDateParts(value, dateFormatIntl, options);
67
+ var monthLongDatePartsByLanguageIntl = getMonthLongDateParts(value, languageIntl, options);
68
+ var translatedDateTimeParts = translateDateTimeParts(monthLongDateParts, monthLongDatePartsByLanguageIntl, options);
69
+ var reducedDateTimeParts = getDateTimePartsSubset(translatedDateTimeParts, ['month']);
70
+ return dateTimePartsToString(reducedDateTimeParts);
71
+ };
72
+ export var convertDateToMonthShortString = function convertDateToMonthShortString(value, dateFormatIntl, languageIntl, options) {
73
+ var monthShortDateParts = getMonthShortDateParts(value, dateFormatIntl, options);
74
+ var monthShortDatePartsByLanguageIntl = getMonthShortDateParts(value, languageIntl, options);
75
+ var translatedDateTimeParts = translateDateTimeParts(monthShortDateParts, monthShortDatePartsByLanguageIntl, options);
76
+ var reducedDateTimeParts = getDateTimePartsSubset(translatedDateTimeParts, ['month']);
77
+ return dateTimePartsToString(reducedDateTimeParts);
78
+ };
79
+ export var addPrefix = function addPrefix(value, options) {
80
+ var result = value;
81
+ if (options != null && options.prefix) {
82
+ result = (options == null ? void 0 : options.prefix) + result;
83
+ }
84
+ return result;
85
+ };
86
+ export var addSuffix = function addSuffix(value, options) {
87
+ var result = value;
88
+ if (options != null && options.suffix) {
89
+ result += options == null ? void 0 : options.suffix;
90
+ }
91
+ return result;
92
+ };
93
+ export var changeNamingConvention = function changeNamingConvention(value, options) {
94
+ var result = value;
95
+ switch (options == null ? void 0 : options.namingConvention) {
96
+ case UPPER_CASE:
97
+ result = result.toUpperCase();
98
+ break;
99
+ case UPPER_FIRST:
100
+ result = result.charAt(0).toUpperCase() + result.slice(1);
101
+ break;
102
+ case LOWER_CASE:
103
+ result = result.toLowerCase();
104
+ break;
105
+ case LOWER_FIRST:
106
+ result = result.charAt(0).toLowerCase() + result.slice(1);
107
+ break;
108
+ default:
109
+ break;
110
+ }
111
+ return result;
112
+ };
113
+ export var getDefaultDataTimeOptions = function getDefaultDataTimeOptions(showTime) {
114
+ return {
115
+ targetFormat: showTime ? DATETIME : DATE,
116
+ dateOptions: DEFAULT_FORMAT_MONTH_SHORT_OPTIONS,
117
+ namingConvention: UPPER_FIRST
118
+ };
119
+ };
@@ -0,0 +1,2 @@
1
+ import { type DataFormatConfig, type DataFormatNotationType } from '../types';
2
+ export declare const getDataFormatConfigFromNotation: (notation: DataFormatNotationType) => DataFormatConfig;
@@ -0,0 +1,8 @@
1
+ export var getDataFormatConfigFromNotation = function getDataFormatConfigFromNotation(notation) {
2
+ return {
3
+ startWeekDayNotation: notation,
4
+ dateFormatNotation: notation,
5
+ timeFormatNotation: notation,
6
+ numberFormatNotation: notation
7
+ };
8
+ };
@@ -0,0 +1,8 @@
1
+ import dayjs from 'dayjs';
2
+ import { type DateConstantsTargetFormat, type DateToFormatOptions } from '../types';
3
+ export declare const getDatesRange: (start: Date, end: Date, interval: dayjs.UnitType) => Date[];
4
+ export declare const isValidDate: (date: Date) => boolean;
5
+ export declare const getConstantDatesAndFormattingOptions: (targetFormat: DateConstantsTargetFormat, isSundayFirstWeekDay: boolean, customStartDate?: Date, customEndDate?: Date, customInterval?: dayjs.UnitType) => {
6
+ constantDates: Date[];
7
+ defaultOptions: DateToFormatOptions;
8
+ };
@@ -0,0 +1,50 @@
1
+ import dayjs from 'dayjs';
2
+ import { MONTHS_LONG, MONTHS_SHORT, MONTH_LONG, MONTH_SHORT, UPPER_FIRST, WEEKDAYS_LONG, WEEKDAYS_SHORT, WEEKDAY_LONG, WEEKDAY_SHORT } from '../constants';
3
+ export var getDatesRange = function getDatesRange(start, end, interval) {
4
+ var startDate = dayjs(start);
5
+ var endDate = dayjs(end);
6
+ var diffInUnits = endDate.diff(startDate, interval);
7
+ return Array.from(Array(diffInUnits + 1).keys()).map(function (i) {
8
+ return startDate.add(i, interval).toDate();
9
+ });
10
+ };
11
+ export var isValidDate = function isValidDate(date) {
12
+ return !isNaN(date.getTime());
13
+ };
14
+ export var getConstantDatesAndFormattingOptions = function getConstantDatesAndFormattingOptions(targetFormat, isSundayFirstWeekDay, customStartDate, customEndDate, customInterval) {
15
+ var startDate = new Date(2023, 0, isSundayFirstWeekDay ? 1 : 2);
16
+ var endDate = new Date(2023, 0, isSundayFirstWeekDay ? 1 : 2);
17
+ var defaultTargetFormat = MONTH_LONG;
18
+ var interval = 'month';
19
+ switch (targetFormat) {
20
+ case MONTHS_LONG:
21
+ endDate.setMonth(11);
22
+ interval = 'month';
23
+ defaultTargetFormat = MONTH_LONG;
24
+ break;
25
+ case MONTHS_SHORT:
26
+ endDate.setMonth(11);
27
+ interval = 'month';
28
+ defaultTargetFormat = MONTH_SHORT;
29
+ break;
30
+ case WEEKDAYS_LONG:
31
+ endDate.setDate(isSundayFirstWeekDay ? 7 : 8);
32
+ interval = 'day';
33
+ defaultTargetFormat = WEEKDAY_LONG;
34
+ break;
35
+ case WEEKDAYS_SHORT:
36
+ endDate.setDate(isSundayFirstWeekDay ? 7 : 8);
37
+ interval = 'day';
38
+ defaultTargetFormat = WEEKDAY_SHORT;
39
+ break;
40
+ default:
41
+ break;
42
+ }
43
+ return {
44
+ constantDates: getDatesRange(customStartDate != null ? customStartDate : startDate, customEndDate != null ? customEndDate : endDate, customInterval != null ? customInterval : interval),
45
+ defaultOptions: {
46
+ namingConvention: UPPER_FIRST,
47
+ targetFormat: defaultTargetFormat
48
+ }
49
+ };
50
+ };