@povio/ui 2.3.0-rc.12 → 2.3.0-rc.13
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/components/inputs/DateTime/DatePicker/DatePicker.js +4 -4
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +10 -10
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +5 -7
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +2 -3
- package/package.json +1 -1
|
@@ -267,14 +267,14 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
|
|
|
267
267
|
if (calendarDate === null) return null;
|
|
268
268
|
const normalizedDate = normalizeByGranularity(calendarDate);
|
|
269
269
|
if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
|
|
270
|
-
const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate);
|
|
271
|
-
return DateTime.fromJSDate(date_0).toISODate();
|
|
270
|
+
const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate, "UTC");
|
|
271
|
+
return DateTime.fromJSDate(date_0, { zone: "UTC" }).toISODate();
|
|
272
272
|
};
|
|
273
273
|
const parseCalendarDate = (formattedDate) => {
|
|
274
274
|
if (formattedDate == null) return formattedDate;
|
|
275
275
|
if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
|
|
276
|
-
const date_1 = DateTime.fromISO(formattedDate).toJSDate();
|
|
277
|
-
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1)));
|
|
276
|
+
const date_1 = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
277
|
+
return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1, "UTC")));
|
|
278
278
|
};
|
|
279
279
|
const dateLimits = {
|
|
280
280
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
@@ -590,11 +590,11 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
590
590
|
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
591
591
|
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
592
592
|
};
|
|
593
|
-
const startDate = DateTimeUtils.fromDateValueToLocal(range.start);
|
|
594
|
-
const endDate = DateTimeUtils.fromDateValueToLocal(range.end);
|
|
593
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
|
|
594
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
|
|
595
595
|
return {
|
|
596
|
-
start: DateTime.fromJSDate(startDate).toISODate(),
|
|
597
|
-
end: DateTime.fromJSDate(endDate).toISODate()
|
|
596
|
+
start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
|
|
597
|
+
end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
|
|
598
598
|
};
|
|
599
599
|
};
|
|
600
600
|
const parseDateRange = (formattedRange) => {
|
|
@@ -603,10 +603,10 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
603
603
|
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
604
604
|
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
605
605
|
};
|
|
606
|
-
const startDate_0 = DateTime.fromISO(formattedRange.start).toJSDate();
|
|
607
|
-
const endDate_0 = DateTime.fromISO(formattedRange.end).toJSDate();
|
|
608
|
-
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0);
|
|
609
|
-
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0);
|
|
606
|
+
const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
|
|
607
|
+
const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
|
|
608
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
|
|
609
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
|
|
610
610
|
return {
|
|
611
611
|
start: toCalendarDate(startZonedDateTime),
|
|
612
612
|
end: toCalendarDate(endZonedDateTime)
|
|
@@ -615,8 +615,8 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
615
615
|
const parseCalendarDate = (formattedDate) => {
|
|
616
616
|
if (formattedDate == null) return formattedDate;
|
|
617
617
|
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
618
|
-
const date = DateTime.fromISO(formattedDate).toJSDate();
|
|
619
|
-
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date));
|
|
618
|
+
const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
619
|
+
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
|
|
620
620
|
};
|
|
621
621
|
const dateLimits = {
|
|
622
622
|
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
@@ -19,12 +19,12 @@ import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react
|
|
|
19
19
|
import { useDatePicker, useLocale } from "react-aria";
|
|
20
20
|
import { mergeRefs } from "@react-aria/utils";
|
|
21
21
|
import { Controller, useWatch } from "react-hook-form";
|
|
22
|
-
import { Time, createCalendar,
|
|
22
|
+
import { Time, createCalendar, now, toCalendarDateTime, today } from "@internationalized/date";
|
|
23
23
|
import { useCalendarState, useDatePickerState } from "react-stately";
|
|
24
24
|
//#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
|
|
25
25
|
var DateTimePickerBase = (props) => {
|
|
26
26
|
const ui = UIConfig.useConfig();
|
|
27
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone, autoFixYear: autoFixYearProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
|
|
27
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, isTimeOptional, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, shouldUpdateDateOnMonthYearChange: shouldUpdateDateOnMonthYearChangeProp, timeZone: _timeZone, autoFixYear: autoFixYearProp, format, setDateValueOnDateSelection: setDateValueOnDateSelectionProp, ...rest } = props;
|
|
28
28
|
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
29
29
|
const variant = variantProp ?? ui.input.variant;
|
|
30
30
|
const as = asProp ?? ui.input.as;
|
|
@@ -38,8 +38,7 @@ var DateTimePickerBase = (props) => {
|
|
|
38
38
|
const shouldUpdateDateOnMonthYearChange = shouldUpdateDateOnMonthYearChangeProp ?? ui.dateInput.shouldUpdateDateOnMonthYearChange;
|
|
39
39
|
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
40
40
|
const setDateValueOnDateSelection = setDateValueOnDateSelectionProp ?? ui.dateInput.setDateValueOnDateSelection;
|
|
41
|
-
|
|
42
|
-
if (timeZone) effectiveTimeZone = timeZone;
|
|
41
|
+
const effectiveTimeZone = "UTC";
|
|
43
42
|
const formFieldProps = {
|
|
44
43
|
error,
|
|
45
44
|
label,
|
|
@@ -85,7 +84,7 @@ var DateTimePickerBase = (props) => {
|
|
|
85
84
|
onChange: (val_0) => {
|
|
86
85
|
onChange?.(val_0);
|
|
87
86
|
dialogState.setValue(val_0);
|
|
88
|
-
calendarState.setFocusedDate(val_0 || today(
|
|
87
|
+
calendarState.setFocusedDate(val_0 || today(effectiveTimeZone));
|
|
89
88
|
debouncedBlur(val_0);
|
|
90
89
|
},
|
|
91
90
|
shouldCloseOnSelect: false,
|
|
@@ -257,8 +256,7 @@ var DateTimePicker = ({ fullIso = true, renderStaticInput, ...props }) => {
|
|
|
257
256
|
let isFormControlDisabled = false;
|
|
258
257
|
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
259
258
|
const rawValue = watchedValue ?? props.value ?? null;
|
|
260
|
-
|
|
261
|
-
if (props.timeZone) effectiveTimeZone = props.timeZone;
|
|
259
|
+
const effectiveTimeZone = "UTC";
|
|
262
260
|
const formatDateValue = (dateValue) => {
|
|
263
261
|
if (dateValue === null) return null;
|
|
264
262
|
if (fullIso) return DateTimeUtils.fromDateValueToISO(dateValue, effectiveTimeZone);
|
|
@@ -17,7 +17,7 @@ import { useEffect, useRef, useState } from "react";
|
|
|
17
17
|
import { useLocale, useTimeField } from "react-aria";
|
|
18
18
|
import { mergeRefs } from "@react-aria/utils";
|
|
19
19
|
import { Controller, useWatch } from "react-hook-form";
|
|
20
|
-
import {
|
|
20
|
+
import { now, toTime } from "@internationalized/date";
|
|
21
21
|
import { DateTime } from "luxon";
|
|
22
22
|
import { useTimeFieldState } from "react-stately";
|
|
23
23
|
//#region src/components/inputs/DateTime/TimePicker/TimePicker.tsx
|
|
@@ -415,8 +415,7 @@ var TimePickerBase = (props) => {
|
|
|
415
415
|
};
|
|
416
416
|
var TimePicker = ({ renderStaticInput, ...props }) => {
|
|
417
417
|
const ui = UIConfig.useConfig();
|
|
418
|
-
|
|
419
|
-
if (props.timeZone) effectiveTimeZone = props.timeZone;
|
|
418
|
+
const effectiveTimeZone = "UTC";
|
|
420
419
|
const { locale } = useLocale();
|
|
421
420
|
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
422
421
|
const inputRef = useRef(null);
|