@motor-hero/ui-kit 0.40.0 → 0.42.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/index.js
CHANGED
|
@@ -978,6 +978,7 @@ var MASK_REPLACEMENT = { _: /\d/ };
|
|
|
978
978
|
var DATE_FORMAT = "dd/MM/yyyy";
|
|
979
979
|
var TIME_FORMAT = "HH:mm";
|
|
980
980
|
var DATE_VALUE_FORMAT = "yyyy-MM-dd";
|
|
981
|
+
var DATETIME_VALUE_FORMAT = "yyyy-MM-dd'T'HH:mm";
|
|
981
982
|
function pad(n) {
|
|
982
983
|
return String(n).padStart(2, "0");
|
|
983
984
|
}
|
|
@@ -993,8 +994,8 @@ function dateOnlyToDate(value) {
|
|
|
993
994
|
}
|
|
994
995
|
function dateTimeToDate(value) {
|
|
995
996
|
if (!value) return void 0;
|
|
996
|
-
const parsed = new Date(
|
|
997
|
-
return
|
|
997
|
+
const parsed = parse(value, DATETIME_VALUE_FORMAT, /* @__PURE__ */ new Date());
|
|
998
|
+
return isValid(parsed) ? parsed : void 0;
|
|
998
999
|
}
|
|
999
1000
|
function displayFor(value, withTime) {
|
|
1000
1001
|
const date = withTime ? dateTimeToDate(value) : dateOnlyToDate(value);
|
|
@@ -1089,7 +1090,7 @@ function DatePickerImpl({
|
|
|
1089
1090
|
if (!time) return;
|
|
1090
1091
|
const combined = new Date(date);
|
|
1091
1092
|
combined.setHours(time.getHours(), time.getMinutes(), 0, 0);
|
|
1092
|
-
onChange(combined
|
|
1093
|
+
onChange(format(combined, DATETIME_VALUE_FORMAT));
|
|
1093
1094
|
setOpen(false);
|
|
1094
1095
|
};
|
|
1095
1096
|
const handleCalendarSelect = (date) => {
|