@portnet/ui 0.1.41 → 0.1.42
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.
|
@@ -51,11 +51,12 @@ const DateTimePickerField = _ref => {
|
|
|
51
51
|
const openDatePopover = Boolean(anchorEl);
|
|
52
52
|
const openTimePopover = Boolean(timeAnchorEl);
|
|
53
53
|
(0, _react.useEffect)(() => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
if (value) {
|
|
55
|
+
const parsedDate = (0, _moment.default)(value);
|
|
56
|
+
const datePart = parsedDate.format(format.split(" ")[0]);
|
|
57
|
+
const timePart = parsedDate.format(format === "DD/MM/YYYY HH:mm:ss" ? "HH:mm:ss" : "HH:mm");
|
|
58
|
+
setRenderedValue("".concat(datePart, " ").concat(timePart));
|
|
59
|
+
}
|
|
59
60
|
}, [value, format]);
|
|
60
61
|
const handleDateTimeClick = event => setAnchorEl(event.currentTarget);
|
|
61
62
|
const handleTimeClick = event => {
|
|
@@ -66,6 +67,8 @@ const DateTimePickerField = _ref => {
|
|
|
66
67
|
const updateCombinedDateTime = (newDate, newTime) => {
|
|
67
68
|
const combinedDateTime = (0, _moment.default)("".concat(newDate, " ").concat(newTime), format === "DD/MM/YYYY HH:mm:ss" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD HH:mm", true).toISOString();
|
|
68
69
|
if ((0, _moment.default)(combinedDateTime).isValid()) {
|
|
70
|
+
const formattedDate = (0, _moment.default)(combinedDateTime).format(format);
|
|
71
|
+
setRenderedValue(formattedDate);
|
|
69
72
|
onChange(combinedDateTime);
|
|
70
73
|
}
|
|
71
74
|
};
|