Hi,
I was wondering if there is a rather easy way to exclude Weekends when using "DateTimeInput"?
Just wanted to prevent Users from accidentally picking dates other than actual workdays...
Any ideas?
Hi,
I was wondering if there is a rather easy way to exclude Weekends when using "DateTimeInput"?
Just wanted to prevent Users from accidentally picking dates other than actual workdays...
Any ideas?
No, the datepicker controls are based on someone else's code and have limited functionality. You can't even set Monday as the first day of the week.
As a workaround you can put a label beside the DateTime Input component and with an expression binding give the user a warning.
if(
(getDayOfWeek({../DateTimeInput.props.value}) = 1)
||
(getDayOfWeek({../DateTimeInput.props.value}) = 7),
"Please select weekday!",
""
)
With a similar expression you could disable the "Save" button or whatever.
Bummer - though thanks for the hint!
Consider using a custom property to hold the "official" selected date, with an expression binding to the date picker that passes through Monday-Friday, subtracts a day from Saturday, and adds a day to Sunday. Use the custom property in any other bindings or scripts that previously used the date picker's property.