@firecms/ui 3.1.0-canary.24c8270 → 3.1.0-canary.75005e4
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.es.js
CHANGED
|
@@ -32933,7 +32933,7 @@ const DateTimeField = ({
|
|
|
32933
32933
|
const [focused, setFocused] = useState(false);
|
|
32934
32934
|
const [internalValue, setInternalValue] = useState("");
|
|
32935
32935
|
const [isTyping, setIsTyping] = useState(false);
|
|
32936
|
-
const invalidValue = value !== void 0 && value !== null && !(value instanceof Date);
|
|
32936
|
+
const invalidValue = value !== void 0 && value !== null && (!(value instanceof Date) || isNaN(value.getTime()));
|
|
32937
32937
|
useInjectStyles("DateTimeField", inputStyles);
|
|
32938
32938
|
const handleClear = (e) => {
|
|
32939
32939
|
e.preventDefault();
|
|
@@ -32956,7 +32956,12 @@ const DateTimeField = ({
|
|
|
32956
32956
|
// undefined = local timezone
|
|
32957
32957
|
};
|
|
32958
32958
|
const formatter = new Intl.DateTimeFormat("en-CA", options);
|
|
32959
|
-
|
|
32959
|
+
let parts;
|
|
32960
|
+
try {
|
|
32961
|
+
parts = formatter.formatToParts(dateValue);
|
|
32962
|
+
} catch {
|
|
32963
|
+
return "";
|
|
32964
|
+
}
|
|
32960
32965
|
const getPart = (type) => parts.find((p) => p.type === type)?.value ?? "";
|
|
32961
32966
|
const year = getPart("year");
|
|
32962
32967
|
const month = getPart("month");
|