Skip to content

Commit 704ee98

Browse files
Fix validation logic for facility fields and improve date selection handling
1 parent 43c6311 commit 704ee98

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

app/routes/create-non-manipulation-document.$documentNumber.add-storage-facility-details.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,17 @@ const validateFacilityFields = (
150150
): Array<{ key: string; message: string }> => {
151151
const errorsArr: Array<{ key: string; message: string }> = [];
152152

153-
if (!values["facilityName"] || String(values["facilityName"]).trim() === "") {
153+
if (result !== null) {
154154
errorsArr.push({
155-
key: fieldPrefixName,
156-
message: "sdAddStorageFacilityDetailsErrorEnterTheFacilityName",
155+
key: "storageFacilities-facilityArrivalDate",
156+
message: t(getErrorMessage(`error.${fieldPrefixDate}.date.isoDate`)),
157157
});
158158
}
159159

160-
if (result !== null) {
160+
if (!values["facilityName"] || String(values["facilityName"]).trim() === "") {
161161
errorsArr.push({
162-
key: fieldPrefixDate,
163-
message: t(getErrorMessage(`error.${fieldPrefixDate}.date.isoDate`)),
162+
key: fieldPrefixName,
163+
message: "sdAddStorageFacilityDetailsErrorEnterTheFacilityName",
164164
});
165165
}
166166

0 commit comments

Comments
 (0)