@@ -165,9 +165,9 @@ createResourceBooking.schema = Joi.object().keys({
165
165
startDate : Joi . date ( ) . allow ( null ) ,
166
166
endDate : Joi . date ( ) . when ( 'startDate' , {
167
167
is : Joi . exist ( ) ,
168
- then : Joi . date ( ) . allow ( null ) . greater ( Joi . ref ( 'startDate' )
168
+ then : Joi . date ( ) . allow ( null ) . min ( Joi . ref ( 'startDate' )
169
169
) . messages ( {
170
- 'date.greater ' : 'endDate must be greater than startDate'
170
+ 'date.min ' : 'endDate cannot be earlier than startDate'
171
171
} ) ,
172
172
otherwise : Joi . date ( ) . allow ( null )
173
173
} ) ,
@@ -222,9 +222,9 @@ partiallyUpdateResourceBooking.schema = Joi.object().keys({
222
222
startDate : Joi . date ( ) . allow ( null ) ,
223
223
endDate : Joi . date ( ) . when ( 'startDate' , {
224
224
is : Joi . exist ( ) ,
225
- then : Joi . date ( ) . allow ( null ) . greater ( Joi . ref ( 'startDate' )
225
+ then : Joi . date ( ) . allow ( null ) . min ( Joi . ref ( 'startDate' )
226
226
) . messages ( {
227
- 'date.greater ' : 'endDate must be greater than startDate'
227
+ 'date.min ' : 'endDate cannot be earlier than startDate'
228
228
} ) ,
229
229
otherwise : Joi . date ( ) . allow ( null )
230
230
} ) ,
@@ -259,9 +259,9 @@ fullyUpdateResourceBooking.schema = Joi.object().keys({
259
259
startDate : Joi . date ( ) . allow ( null ) . default ( null ) ,
260
260
endDate : Joi . date ( ) . when ( 'startDate' , {
261
261
is : Joi . exist ( ) ,
262
- then : Joi . date ( ) . allow ( null ) . default ( null ) . greater ( Joi . ref ( 'startDate' )
262
+ then : Joi . date ( ) . allow ( null ) . default ( null ) . min ( Joi . ref ( 'startDate' )
263
263
) . messages ( {
264
- 'date.greater ' : 'endDate must be greater than startDate'
264
+ 'date.min ' : 'endDate cannot be earlier than startDate'
265
265
} ) ,
266
266
otherwise : Joi . date ( ) . allow ( null ) . default ( null )
267
267
} ) ,
0 commit comments