@wix/form-public 0.152.0 → 0.153.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.cjs +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -5823,6 +5823,10 @@ function deriveDateFieldError(_validation, error, value) {
|
|
|
5823
5823
|
if (!error || !isFormatError) {
|
|
5824
5824
|
return void 0;
|
|
5825
5825
|
}
|
|
5826
|
+
const format = error.params?.format;
|
|
5827
|
+
if (format !== "date" && format !== "date-time") {
|
|
5828
|
+
return void 0;
|
|
5829
|
+
}
|
|
5826
5830
|
const { YEAR: _YEAR, MONTH, DAY } = deserializeDate(value);
|
|
5827
5831
|
const YEAR = _YEAR?.length === 4;
|
|
5828
5832
|
if (!YEAR && !MONTH && !DAY) {
|
|
@@ -5856,13 +5860,14 @@ function deriveDateTimeFieldError(validation, error, value) {
|
|
|
5856
5860
|
if (!error || !isFormatError) {
|
|
5857
5861
|
return void 0;
|
|
5858
5862
|
}
|
|
5863
|
+
const format = error.params?.format;
|
|
5864
|
+
if (format !== "date-time") {
|
|
5865
|
+
return void 0;
|
|
5866
|
+
}
|
|
5859
5867
|
const [date, time] = parseDateTimeValue(value);
|
|
5860
5868
|
const dateValidationError = deriveDateFieldError(validation, error, date);
|
|
5861
5869
|
const { YEAR, MONTH, DAY } = deserializeDate(date);
|
|
5862
5870
|
const timeComplete = isTimeComplete(time);
|
|
5863
|
-
if (!timeComplete && YEAR?.length !== 4 && !MONTH && !DAY) {
|
|
5864
|
-
return void 0;
|
|
5865
|
-
}
|
|
5866
5871
|
if (!timeComplete) {
|
|
5867
5872
|
const withErrorSuffix = (suffix) => ({
|
|
5868
5873
|
...error,
|
|
@@ -5890,7 +5895,9 @@ function deriveDateTimeFieldError(validation, error, value) {
|
|
|
5890
5895
|
return withErrorSuffix(DateTimeFieldErrorSuffix.DAY_TIME);
|
|
5891
5896
|
}
|
|
5892
5897
|
}
|
|
5893
|
-
|
|
5898
|
+
if (YEAR || MONTH || DAY) {
|
|
5899
|
+
return withErrorSuffix(DateTimeFieldErrorSuffix.TIME);
|
|
5900
|
+
}
|
|
5894
5901
|
}
|
|
5895
5902
|
return dateValidationError;
|
|
5896
5903
|
}
|