@@ -165,9 +165,9 @@ createResourceBooking.schema = Joi.object().keys({
165165 startDate : Joi . date ( ) . allow ( null ) ,
166166 endDate : Joi . date ( ) . when ( 'startDate' , {
167167 is : Joi . exist ( ) ,
168- then : Joi . date ( ) . allow ( null ) . greater ( Joi . ref ( 'startDate' )
168+ then : Joi . date ( ) . allow ( null ) . min ( Joi . ref ( 'startDate' )
169169 ) . messages ( {
170- 'date.greater ' : 'endDate must be greater than startDate'
170+ 'date.min ' : 'endDate cannot be earlier than startDate'
171171 } ) ,
172172 otherwise : Joi . date ( ) . allow ( null )
173173 } ) ,
@@ -222,9 +222,9 @@ partiallyUpdateResourceBooking.schema = Joi.object().keys({
222222 startDate : Joi . date ( ) . allow ( null ) ,
223223 endDate : Joi . date ( ) . when ( 'startDate' , {
224224 is : Joi . exist ( ) ,
225- then : Joi . date ( ) . allow ( null ) . greater ( Joi . ref ( 'startDate' )
225+ then : Joi . date ( ) . allow ( null ) . min ( Joi . ref ( 'startDate' )
226226 ) . messages ( {
227- 'date.greater ' : 'endDate must be greater than startDate'
227+ 'date.min ' : 'endDate cannot be earlier than startDate'
228228 } ) ,
229229 otherwise : Joi . date ( ) . allow ( null )
230230 } ) ,
@@ -259,9 +259,9 @@ fullyUpdateResourceBooking.schema = Joi.object().keys({
259259 startDate : Joi . date ( ) . allow ( null ) . default ( null ) ,
260260 endDate : Joi . date ( ) . when ( 'startDate' , {
261261 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' )
263263 ) . messages ( {
264- 'date.greater ' : 'endDate must be greater than startDate'
264+ 'date.min ' : 'endDate cannot be earlier than startDate'
265265 } ) ,
266266 otherwise : Joi . date ( ) . allow ( null ) . default ( null )
267267 } ) ,
0 commit comments