How to set date/time field for weekdays only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2022 04:17 AM
Hi All,
I have created one Date-Time field.
I want to throw an error message to user, when user selects date on either saturday/sunday.
User must select only working days(Mon-Fri)
How to achieve it ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 02:16 AM
Hi
Yepp it can be possible, For me below line of code worked.
if(dayCount == 5 || dayCount == 6) // 5 - sat & 6 - sun
Thank you for the information.
Cheers..!
Happy learning 🙂
Tushar
Cheers..!
Happy Learning:)
Tushar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 11:03 PM
Hello ,
If my response helped you please close the thread by marking appropriate response as correct so that it help others.
Cheers..!
Happy Learning:)
Tushar
Cheers..!
Happy Learning:)
Tushar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2022 11:47 PM
Hi,
Use the simple below code, it works..tested..
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var date = new Date(newValue),
day = date.getDay();
if (day === 0 || day === 6) {
g_form.addErrorMessage("It's a weekend");
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2022 02:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2025 01:17 AM
It is calculating the daycount from the current day
For ex-if today is a tuesday it counts today as a daycount 1