Throw an error when weekends are selected between start date - end date

0
Hello Everybody,   I need to throw an error when user select start date - end date and there are the weekends between. I'm currently working with the official calendar widget.      Example from the picture - user selects 14.02 (Friday) - 17.02 (Monday). Saturday and Sunday are between. App should not let them save that choice since there are non-working days between. Thank you !
asked
2 answers
0

Hello Georgi Ivanov,

 

You can create a change microflow for both your start and end dates. 

 

In your Microflow Logic 

 

  1. Create a DateTime variable (name: DateIterator) and initialize it with the start date.
  2. Add a While loop, and the condition should be $DateIterator <= $Object/EndDate
  3. Add ObjectDecision Split and Check the condition mentioned by Martijn Hingstman and if it is less than 6, increment the date variable by 1 day, and if false, show a message and end the flow using the break event.

 

 

 

 

image.png

 

ATB!!

answered
0

Hi Georgi,

 

You can check the day of the week using this statement: parseInteger(formatDateTime($Date, 'u')) (See this topic for more information: Mendix Community - Question Details)

You can then throw an error or a validation feedback if a weekend day is selected.

 

Best regards,

Martijn

answered