Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 4568280

Browse files
committed
lint fix
1 parent 4f0ec9b commit 4568280

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

src/components/TCForm/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ export const getValidator = (fields) => {
7575
.forEach((f) => {
7676
if (f.isRequired && !values[f.name]) {
7777
errors[f.name] = f.validationMessage;
78-
}else if (f.customValidator){
78+
} else if (f.customValidator) {
7979
const error = f.customValidator(f, fields, values);
80-
if(error){
80+
if (error) {
8181
errors[f.name] = error;
8282
}
8383
}

src/routes/ResourceBookingForm/utils.js

+24-12
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
*
44
* utility class
55
*/
6-
import moment from 'moment';
7-
import _ from 'lodash';
6+
import moment from "moment";
7+
import _ from "lodash";
88
import {
99
STATUS_OPTIONS,
1010
FORM_ROW_TYPE,
@@ -48,29 +48,41 @@ export const getEditResourceBookingConfig = (onSubmit) => {
4848
name: "startDate",
4949
placeholder: "Start Date",
5050
customValidator: (field, fields, values) => {
51-
const endDateField = _.find(fields, {'name': 'endDate'});
51+
const endDateField = _.find(fields, { name: "endDate" });
5252
const startDate = values[field.name];
53-
const endDate = values['endDate'];
54-
if(startDate && endDate && moment(endDate).startOf('day').isBefore(moment(startDate).startOf('day'))){
55-
return 'Start Date should not be after End Date';
53+
const endDate = values["endDate"];
54+
if (
55+
startDate &&
56+
endDate &&
57+
moment(endDate)
58+
.startOf("day")
59+
.isBefore(moment(startDate).startOf("day"))
60+
) {
61+
return "Start Date should not be after End Date";
5662
}
5763
return null;
58-
}
64+
},
5965
},
6066
{
6167
label: "End Date",
6268
type: FORM_FIELD_TYPE.DATE,
6369
name: "endDate",
6470
placeholder: "End Date",
6571
customValidator: (field, fields, values) => {
66-
const startDateField = _.find(fields, {'name': 'startDate'});
72+
const startDateField = _.find(fields, { name: "startDate" });
6773
const endDate = values[field.name];
68-
const startDate = values['startDate'];
69-
if(startDate && endDate && moment(endDate).startOf('day').isBefore(moment(startDate).startOf('day'))){
70-
return 'End Date should not be before Start Date';
74+
const startDate = values["startDate"];
75+
if (
76+
startDate &&
77+
endDate &&
78+
moment(endDate)
79+
.startOf("day")
80+
.isBefore(moment(startDate).startOf("day"))
81+
) {
82+
return "End Date should not be before Start Date";
7183
}
7284
return null;
73-
}
85+
},
7486
},
7587
{
7688
label: "Status",

0 commit comments

Comments
 (0)