@gravity-ui/date-components 2.8.3 → 2.10.0
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/dist/cjs/components/CalendarView/Calendar.css +1 -1
- package/dist/cjs/components/CalendarView/CalendarView.js +3 -2
- package/dist/cjs/components/CalendarView/hooks/types.d.ts +2 -0
- package/dist/cjs/components/CalendarView/hooks/useCalendarCellProps.js +22 -19
- package/dist/cjs/components/CalendarView/hooks/useCalendarGridProps.js +2 -1
- package/dist/cjs/components/CalendarView/hooks/useCalendarProps.js +2 -1
- package/dist/cjs/components/CalendarView/hooks/useCalendarState.js +14 -8
- package/dist/cjs/components/CalendarView/hooks/useRangeCalendarState.js +1 -2
- package/dist/cjs/components/CalendarView/utils.d.ts +0 -1
- package/dist/cjs/components/CalendarView/utils.js +0 -10
- package/dist/cjs/components/DateField/hooks/useDateFieldProps.js +1 -4
- package/dist/cjs/components/RangeDatePicker/RangeDatePicker.js +1 -1
- package/dist/cjs/components/RelativeDateField/hooks/useRelativeDateFieldProps.js +1 -0
- package/dist/cjs/components/RelativeRangeDatePicker/RelativeRangeDatePicker.css +0 -34
- package/dist/cjs/components/RelativeRangeDatePicker/RelativeRangeDatePicker.d.ts +1 -30
- package/dist/cjs/components/RelativeRangeDatePicker/RelativeRangeDatePicker.js +16 -50
- package/dist/cjs/components/RelativeRangeDatePicker/components/Control/Control.css +34 -0
- package/dist/cjs/components/RelativeRangeDatePicker/components/Control/Control.d.ts +16 -0
- package/dist/cjs/components/RelativeRangeDatePicker/components/Control/Control.js +64 -0
- package/dist/cjs/components/RelativeRangeDatePicker/components/Control/i18n/en.json +3 -0
- package/dist/cjs/components/RelativeRangeDatePicker/components/Control/i18n/index.d.ts +1 -0
- package/dist/cjs/components/RelativeRangeDatePicker/components/Control/i18n/index.js +11 -0
- package/dist/cjs/components/RelativeRangeDatePicker/components/Control/i18n/ru.json +3 -0
- package/dist/cjs/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.d.ts +1 -1
- package/dist/cjs/components/RelativeRangeDatePicker/components/PickerDialog/useRelativeRangeDatePickerDialogState.d.ts +1 -1
- package/dist/cjs/components/RelativeRangeDatePicker/components/Zones/Zones.js +2 -2
- package/dist/cjs/components/RelativeRangeDatePicker/i18n/en.json +1 -2
- package/dist/cjs/components/RelativeRangeDatePicker/i18n/index.d.ts +1 -1
- package/dist/cjs/components/RelativeRangeDatePicker/i18n/ru.json +1 -2
- package/dist/cjs/components/RelativeRangeDatePicker/types.d.ts +42 -0
- package/dist/cjs/components/RelativeRangeDatePicker/types.js +2 -0
- package/dist/cjs/components/utils/dates.d.ts +3 -0
- package/dist/cjs/components/utils/dates.js +18 -0
- package/dist/esm/components/CalendarView/Calendar.css +1 -1
- package/dist/esm/components/CalendarView/CalendarView.js +3 -2
- package/dist/esm/components/CalendarView/hooks/types.d.ts +2 -0
- package/dist/esm/components/CalendarView/hooks/useCalendarCellProps.js +22 -19
- package/dist/esm/components/CalendarView/hooks/useCalendarGridProps.js +2 -1
- package/dist/esm/components/CalendarView/hooks/useCalendarProps.js +2 -1
- package/dist/esm/components/CalendarView/hooks/useCalendarState.js +9 -3
- package/dist/esm/components/CalendarView/hooks/useRangeCalendarState.js +1 -2
- package/dist/esm/components/CalendarView/utils.d.ts +0 -1
- package/dist/esm/components/CalendarView/utils.js +0 -9
- package/dist/esm/components/DateField/hooks/useDateFieldProps.js +1 -4
- package/dist/esm/components/RangeDatePicker/RangeDatePicker.js +1 -1
- package/dist/esm/components/RelativeDateField/hooks/useRelativeDateFieldProps.js +1 -0
- package/dist/esm/components/RelativeRangeDatePicker/RelativeRangeDatePicker.css +0 -34
- package/dist/esm/components/RelativeRangeDatePicker/RelativeRangeDatePicker.d.ts +1 -30
- package/dist/esm/components/RelativeRangeDatePicker/RelativeRangeDatePicker.js +17 -51
- package/dist/esm/components/RelativeRangeDatePicker/components/Control/Control.css +34 -0
- package/dist/esm/components/RelativeRangeDatePicker/components/Control/Control.d.ts +16 -0
- package/dist/esm/components/RelativeRangeDatePicker/components/Control/Control.js +58 -0
- package/dist/esm/components/RelativeRangeDatePicker/components/Control/i18n/en.json +3 -0
- package/dist/esm/components/RelativeRangeDatePicker/components/Control/i18n/index.d.ts +1 -0
- package/dist/esm/components/RelativeRangeDatePicker/components/Control/i18n/index.js +5 -0
- package/dist/esm/components/RelativeRangeDatePicker/components/Control/i18n/ru.json +3 -0
- package/dist/esm/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.d.ts +1 -1
- package/dist/esm/components/RelativeRangeDatePicker/components/PickerDialog/useRelativeRangeDatePickerDialogState.d.ts +1 -1
- package/dist/esm/components/RelativeRangeDatePicker/components/Zones/Zones.js +2 -2
- package/dist/esm/components/RelativeRangeDatePicker/i18n/en.json +1 -2
- package/dist/esm/components/RelativeRangeDatePicker/i18n/index.d.ts +1 -1
- package/dist/esm/components/RelativeRangeDatePicker/i18n/ru.json +1 -2
- package/dist/esm/components/RelativeRangeDatePicker/types.d.ts +42 -0
- package/dist/esm/components/RelativeRangeDatePicker/types.js +1 -0
- package/dist/esm/components/utils/dates.d.ts +3 -0
- package/dist/esm/components/utils/dates.js +15 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.g-date-relative-range-date-picker-control__input {
|
|
2
|
+
caret-color: transparent;
|
|
3
|
+
}
|
|
4
|
+
.g-date-relative-range-date-picker-control__input_mobile {
|
|
5
|
+
pointer-events: none;
|
|
6
|
+
}
|
|
7
|
+
.g-date-relative-range-date-picker-control__mobile-trigger {
|
|
8
|
+
--_--g-date-mobile-trigger-clear-width: 0px;
|
|
9
|
+
--_--g-date-mobile-trigger-errors-width: 0px;
|
|
10
|
+
--_--g-date-mobile-trigger-button-width: 24px;
|
|
11
|
+
position: absolute;
|
|
12
|
+
inset: 0;
|
|
13
|
+
inset-inline-end: calc(var(--g-spacing-2) + var(--_--g-date-mobile-trigger-button-width) + var(--_--g-date-mobile-trigger-clear-width) + var(--_--g-date-mobile-trigger-errors-width));
|
|
14
|
+
opacity: 0;
|
|
15
|
+
}
|
|
16
|
+
.g-date-relative-range-date-picker-control__mobile-trigger_size_s {
|
|
17
|
+
--_--g-date-mobile-trigger-button-width: 20px;
|
|
18
|
+
}
|
|
19
|
+
.g-date-relative-range-date-picker-control__mobile-trigger_size_l {
|
|
20
|
+
--_--g-date-mobile-trigger-button-width: 28px;
|
|
21
|
+
}
|
|
22
|
+
.g-date-relative-range-date-picker-control__mobile-trigger_size_xl {
|
|
23
|
+
--_--g-date-mobile-trigger-button-width: 36px;
|
|
24
|
+
}
|
|
25
|
+
.g-date-relative-range-date-picker-control__mobile-trigger_has-clear {
|
|
26
|
+
--_--g-date-mobile-trigger-clear-width: calc(
|
|
27
|
+
var(--_--g-date-mobile-trigger-button-width) + 2px
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
.g-date-relative-range-date-picker-control__mobile-trigger_has-errors {
|
|
31
|
+
--_--g-date-mobile-trigger-errors-width: calc(
|
|
32
|
+
var(--_--g-date-mobile-trigger-button-width) + 2px
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RelativeRangeDatePickerState } from '../../hooks/useRelativeRangeDatePickerState';
|
|
3
|
+
import type { RelativeRangeDatePickerProps } from '../../types';
|
|
4
|
+
import './Control.css';
|
|
5
|
+
export type ControlProps = {
|
|
6
|
+
props: RelativeRangeDatePickerProps;
|
|
7
|
+
state: RelativeRangeDatePickerState;
|
|
8
|
+
open: boolean;
|
|
9
|
+
isMobile?: boolean;
|
|
10
|
+
onClick: (e: React.MouseEvent<HTMLElement>) => void;
|
|
11
|
+
onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;
|
|
12
|
+
onFocus: (e: React.FocusEvent<HTMLElement>) => void;
|
|
13
|
+
onClickCalendar: (e: React.MouseEvent<HTMLElement>) => void;
|
|
14
|
+
onUpdate: (value: string) => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const Control: React.ForwardRefExoticComponent<ControlProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Calendar as CalendarIcon } from '@gravity-ui/icons';
|
|
4
|
+
import { Button, Icon, TextInput } from '@gravity-ui/uikit';
|
|
5
|
+
import { block } from '../../../../utils/cn';
|
|
6
|
+
import { getButtonSizeForInput } from '../../../utils/getButtonSizeForInput';
|
|
7
|
+
import { getDefaultTitle } from '../../utils';
|
|
8
|
+
import { i18n } from './i18n';
|
|
9
|
+
import './Control.css';
|
|
10
|
+
const b = block('relative-range-date-picker-control');
|
|
11
|
+
export const Control = React.forwardRef(({ props, state, open, isMobile, onClick, onKeyDown, onFocus, onClickCalendar, onUpdate }, ref) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const { alwaysShowAsAbsolute, presetTabs, getRangeTitle } = props;
|
|
14
|
+
const format = props.format || 'L';
|
|
15
|
+
const text = React.useMemo(() => typeof getRangeTitle === 'function'
|
|
16
|
+
? getRangeTitle(state.value, state.timeZone)
|
|
17
|
+
: getDefaultTitle({
|
|
18
|
+
value: state.value,
|
|
19
|
+
timeZone: state.timeZone,
|
|
20
|
+
alwaysShowAsAbsolute,
|
|
21
|
+
format,
|
|
22
|
+
presets: presetTabs === null || presetTabs === void 0 ? void 0 : presetTabs.flatMap(({ presets }) => presets),
|
|
23
|
+
}), [alwaysShowAsAbsolute, format, getRangeTitle, presetTabs, state.timeZone, state.value]);
|
|
24
|
+
const validationState = props.validationState || (state.isInvalid ? 'invalid' : undefined);
|
|
25
|
+
const errorMessage = (_a = props.errorMessage) !== null && _a !== void 0 ? _a : state.errors.join('\n');
|
|
26
|
+
const triggerProps = {
|
|
27
|
+
id: props.id,
|
|
28
|
+
role: 'combobox',
|
|
29
|
+
'aria-haspopup': 'dialog',
|
|
30
|
+
'aria-expanded': open,
|
|
31
|
+
'aria-label': props['aria-label'],
|
|
32
|
+
'aria-labelledby': props['aria-labelledby'],
|
|
33
|
+
'aria-describedby': props['aria-describedby'],
|
|
34
|
+
'aria-details': props['aria-details'],
|
|
35
|
+
disabled: props.disabled,
|
|
36
|
+
readOnly: props.readOnly,
|
|
37
|
+
onClick: onClickCalendar,
|
|
38
|
+
onKeyDown,
|
|
39
|
+
};
|
|
40
|
+
return props.renderControl ? (props.renderControl({
|
|
41
|
+
ref,
|
|
42
|
+
value: state.value,
|
|
43
|
+
title: text,
|
|
44
|
+
validationState,
|
|
45
|
+
errorMessage,
|
|
46
|
+
open,
|
|
47
|
+
triggerProps,
|
|
48
|
+
})) : (_jsxs(React.Fragment, { children: [_jsx(TextInput, { id: props.id, autoFocus: props.autoFocus, controlRef: ref, value: text, placeholder: props.placeholder, onUpdate: onUpdate, controlProps: Object.assign(Object.assign({ className: b('input', { mobile: isMobile }) }, triggerProps), { disabled: isMobile, onClick }), onKeyDown: onKeyDown, onFocus: onFocus, validationState: validationState, errorMessage: errorMessage, errorPlacement: props.errorPlacement, pin: props.pin, size: props.size, label: props.label, hasClear: props.hasClear, disabled: props.disabled, endContent: _jsx(Button, { view: "flat-secondary", size: getButtonSizeForInput(props.size), disabled: props.disabled, extraProps: {
|
|
49
|
+
'aria-haspopup': 'dialog',
|
|
50
|
+
'aria-expanded': open,
|
|
51
|
+
'aria-label': i18n('Range date picker'),
|
|
52
|
+
}, onClick: onClickCalendar, children: _jsx(Icon, { data: CalendarIcon }) }) }), isMobile ? (_jsx("button", { className: b('mobile-trigger', {
|
|
53
|
+
'has-clear': Boolean(props.hasClear && state.value),
|
|
54
|
+
'has-errors': state.isInvalid && props.errorPlacement === 'inside',
|
|
55
|
+
size: props.size,
|
|
56
|
+
}), onClick: onClick })) : null] }));
|
|
57
|
+
});
|
|
58
|
+
Control.displayName = 'Control';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const i18n: (key: "Range date picker", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { addComponentKeysets } from '@gravity-ui/uikit/i18n';
|
|
2
|
+
import { NAMESPACE } from '../../../../../utils/cn';
|
|
3
|
+
import en from './en.json';
|
|
4
|
+
import ru from './ru.json';
|
|
5
|
+
export const i18n = addComponentKeysets({ en, ru }, `${NAMESPACE}relative-range-date-picker-control`);
|
package/dist/esm/components/RelativeRangeDatePicker/components/PickerDialog/PickerDialog.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RelativeRangeDatePickerProps } from '../../RelativeRangeDatePicker';
|
|
2
1
|
import type { RelativeRangeDatePickerState } from '../../hooks/useRelativeRangeDatePickerState';
|
|
2
|
+
import type { RelativeRangeDatePickerProps } from '../../types';
|
|
3
3
|
import './PickerDialog.css';
|
|
4
4
|
export interface PickerDialogProps {
|
|
5
5
|
className?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Value } from '../../../RelativeDatePicker';
|
|
2
|
-
import type { RelativeRangeDatePickerProps } from '../../RelativeRangeDatePicker';
|
|
3
2
|
import type { RelativeRangeDatePickerState } from '../../hooks/useRelativeRangeDatePickerState';
|
|
3
|
+
import type { RelativeRangeDatePickerProps } from '../../types';
|
|
4
4
|
export declare function useRelativeRangeDatePickerDialogState(state: RelativeRangeDatePickerState, props: RelativeRangeDatePickerProps): {
|
|
5
5
|
start: Value | null;
|
|
6
6
|
end: Value | null;
|
|
@@ -40,14 +40,14 @@ const b = block('relative-range-date-picker-zones');
|
|
|
40
40
|
export function Zones(props) {
|
|
41
41
|
const timeZone = normalizeTimeZone(props.value);
|
|
42
42
|
const size = props.isMobile ? 'xl' : props.size;
|
|
43
|
-
return (_jsx(Select, { value: [timeZone], options: zones, size: size, onUpdate: (v) => {
|
|
43
|
+
return (_jsx(Select, { disabled: props.disabled, value: [timeZone], options: zones, size: size, onUpdate: (v) => {
|
|
44
44
|
const tz = v[0];
|
|
45
45
|
if (tz) {
|
|
46
46
|
props.onUpdate(tz);
|
|
47
47
|
}
|
|
48
48
|
}, width: "max", renderControl: (controlProps) => {
|
|
49
49
|
const value = timeZone === 'system' || timeZone === 'default' ? i18n(timeZone) : timeZone;
|
|
50
|
-
return (_jsxs(Button, { onClick: controlProps.onClick, ref: controlProps.ref, view: "flat-secondary", width: "max", pin: "clear-clear", size: size, extraProps: {
|
|
50
|
+
return (_jsxs(Button, { onClick: controlProps.onClick, ref: controlProps.ref, view: "flat-secondary", width: "max", pin: "clear-clear", size: size, disabled: props.disabled, extraProps: {
|
|
51
51
|
'aria-haspopup': 'listbox',
|
|
52
52
|
'aria-expanded': controlProps.open,
|
|
53
53
|
onKeyDown: controlProps.onKeyDown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const i18n: (key: "\"From\"" | "\"From\" is required." | "\"To\"" | "\"To\" is required." | "\"From\" can't be after \"To\"." | "to"
|
|
1
|
+
export declare const i18n: (key: "\"From\"" | "\"From\" is required." | "\"To\"" | "\"To\" is required." | "\"From\" can't be after \"To\"." | "to", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { DateTime } from '@gravity-ui/date-utils';
|
|
2
|
+
import type { Value } from '../RelativeDatePicker';
|
|
3
|
+
import type { AccessibilityProps, DomProps, FocusableProps, InputBase, InputDOMProps, RangeValue, StyleProps, TextInputProps, Validation } from '../types';
|
|
4
|
+
import type { Preset } from './components/Presets/defaultPresets';
|
|
5
|
+
import type { PresetTab } from './components/Presets/utils';
|
|
6
|
+
import type { RelativeRangeDatePickerStateOptions, RelativeRangeDatePickerValue } from './hooks/useRelativeRangeDatePickerState';
|
|
7
|
+
export type RelativeRangeDatePickerTriggerProps = Pick<React.InputHTMLAttributes<HTMLElement>, 'id' | 'role' | 'aria-controls' | 'aria-haspopup' | 'aria-expanded' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-details' | 'onClick' | 'onKeyDown' | 'disabled' | 'readOnly'>;
|
|
8
|
+
export interface RelativeRangeDatePickerRenderControlProps {
|
|
9
|
+
ref: React.Ref<HTMLElement>;
|
|
10
|
+
value: RelativeRangeDatePickerValue | null;
|
|
11
|
+
title: string;
|
|
12
|
+
errorMessage?: React.ReactNode;
|
|
13
|
+
validationState?: 'invalid';
|
|
14
|
+
open: boolean;
|
|
15
|
+
triggerProps: RelativeRangeDatePickerTriggerProps;
|
|
16
|
+
}
|
|
17
|
+
export interface RelativeRangeDatePickerProps extends RelativeRangeDatePickerStateOptions, DomProps, AccessibilityProps, InputBase, InputDOMProps, TextInputProps, Validation, FocusableProps, StyleProps {
|
|
18
|
+
/** Format of the date when rendered in the input. [Available formats](https://day.js.org/docs/en/display/format) */
|
|
19
|
+
format?: string;
|
|
20
|
+
/** A placeholder date that controls the default values of each segment when the user first interacts with them. Defaults to today's date at midnight. */
|
|
21
|
+
placeholderValue?: DateTime;
|
|
22
|
+
/** Apply changes with button */
|
|
23
|
+
withApplyButton?: boolean;
|
|
24
|
+
/** Show time zone selector */
|
|
25
|
+
withZonesList?: boolean;
|
|
26
|
+
/** Show relative range presets */
|
|
27
|
+
withPresets?: boolean;
|
|
28
|
+
/** Custom preset tabs */
|
|
29
|
+
presetTabs?: PresetTab[];
|
|
30
|
+
/** Custom docs for presets, if empty array docs will be hidden */
|
|
31
|
+
docs?: Preset[];
|
|
32
|
+
/** Show selected relative values as absolute dates */
|
|
33
|
+
alwaysShowAsAbsolute?: boolean;
|
|
34
|
+
/** */
|
|
35
|
+
getRangeTitle?: (value: RangeValue<Value | null> | null, timeZone: string) => string;
|
|
36
|
+
/** Sets the CSS className for the popup element. */
|
|
37
|
+
popupClassName?: string;
|
|
38
|
+
/** Handler that is called when the popup's open state changes. */
|
|
39
|
+
onOpenChange?: (open: boolean) => void;
|
|
40
|
+
/** Used to render control. */
|
|
41
|
+
renderControl?: (props: RelativeRangeDatePickerRenderControlProps) => React.ReactElement;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { DateTime } from '@gravity-ui/date-utils';
|
|
2
|
+
export declare function isWeekend(date: DateTime): boolean;
|
|
2
3
|
export interface PlaceholderValueOptions {
|
|
3
4
|
placeholderValue?: DateTime;
|
|
4
5
|
timeZone?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare function createPlaceholderValue({ placeholderValue, timeZone }: PlaceholderValueOptions): DateTime;
|
|
7
8
|
export declare function isInvalid(value: DateTime | null | undefined, minValue: DateTime | undefined, maxValue: DateTime | undefined): boolean;
|
|
9
|
+
export declare function constrainValue(value: DateTime, minValue: DateTime | undefined, maxValue: DateTime | undefined): DateTime;
|
|
8
10
|
export declare function mergeDateTime(date: DateTime, time: DateTime): DateTime;
|
|
11
|
+
export declare function formatDateTime(date: DateTime, format: string, timezone: string): string;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { dateTime } from '@gravity-ui/date-utils';
|
|
2
|
+
export function isWeekend(date) {
|
|
3
|
+
return [0, 6].includes(date.day());
|
|
4
|
+
}
|
|
2
5
|
export function createPlaceholderValue({ placeholderValue, timeZone }) {
|
|
3
6
|
return (placeholderValue !== null && placeholderValue !== void 0 ? placeholderValue : dateTime({ timeZone }).set('hour', 0).set('minute', 0).set('second', 0));
|
|
4
7
|
}
|
|
@@ -14,9 +17,21 @@ export function isInvalid(value, minValue, maxValue) {
|
|
|
14
17
|
}
|
|
15
18
|
return false;
|
|
16
19
|
}
|
|
20
|
+
export function constrainValue(value, minValue, maxValue) {
|
|
21
|
+
if (minValue && value.isBefore(minValue)) {
|
|
22
|
+
return minValue;
|
|
23
|
+
}
|
|
24
|
+
if (maxValue && maxValue.isBefore(value)) {
|
|
25
|
+
return maxValue;
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
17
29
|
export function mergeDateTime(date, time) {
|
|
18
30
|
return date
|
|
19
31
|
.set('hours', time.hour())
|
|
20
32
|
.set('minutes', time.minute())
|
|
21
33
|
.set('seconds', time.second());
|
|
22
34
|
}
|
|
35
|
+
export function formatDateTime(date, format, timezone) {
|
|
36
|
+
return dateTime({ input: date, timeZone: timezone }).format(format);
|
|
37
|
+
}
|