How to remove Sundays and Saturdays from the calendar pickers?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 11:24 AM
Okay so in Project we have a lot of Date/Time fields. One of them, and only one, we need to exclude weekends from being valid options to choose. We know we can do a client script or business rule so that after they pick it, we can prompt them. However, we were asked by the process owner if we could could gray-out or remove the weekends so they couldn't even be chosen.
So, one of my co-workers, who has extensive web development backgrounds, was looking at the code and noticed that it looks like the calendar picker uses the exact same pop-up for all of the Date/Time fields. He thought maybe he could apply a style to hide the days 0 and 6, but then unfortunately since all of the date/time fields appear to use the same pop-up, then it would hide the weekends for all the dat fields.
Here is specifically what he wrote to me:
I am looking to set a style of display = none for the ids in the calendar: GwtDateTimePicker_day# for 0 and 6.
Has anyone come accross this need before and addressed it via the pop-up, and if so, then how?
I'm sure Mark Stanger (Crossfuze) has a solution This looks right up his alley.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 11:57 AM
Hey Gary, it's possible to inject styles into a particular form by creating a UI macro/formatter setup with your custom style and adding that to the form. That code might look like this...
<?xml version="1.0" encoding="utf-8"?>
<j:jelly trim="true" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<style>
#GwtDateTimePicker_day7
{
pointer-events: none;
color: #bbbbbb;
}
</style>
</j:jelly>
The real problem is that 0 and 6 refer to specific days, not Sunday and Saturday so there's really no way of targeting days of the week with CSS that I can see. That leaves you with the possibility of a messy client-script solution that might work, which I've done before as well. The problem with that is that your client script can only be invoked when the date picker dialog is initially rendered. After that, the user could click into a new month and you wouldn't have any ability to consistently disable dates after that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 12:33 PM
Mark Stanger (Crossfuze) Thanks so much! Using your suggestion of UI Macro and Formatter we were able to completey remove all Sundays and Saturdays from the calendars. We had to tweak it jsut a bit to the following:
<style>
#GwtDateTimePicker_day0 {display:none;}
#GwtDateTimePicker_day6 {display:none;}
#GwtDateTimePicker_day7 {display:none;}
#GwtDateTimePicker_day13 {display:none;}
#GwtDateTimePicker_day14 {display:none;}
#GwtDateTimePicker_day20 {display:none;}
#GwtDateTimePicker_day21 {display:none;}
#GwtDateTimePicker_day27 {display:none;}
#GwtDateTimePicker_day28 {display:none;}
#GwtDateTimePicker_day34 {display:none;}
#GwtDateTimePicker_day35 {display:none;}
#GwtDateTimePicker_day41 {display:none;}
</style>
We found that day0 doesn't refer to a literal day, rather to a location in the table that builds the calendar formatter, so days 0, 7, 14, etc are always saturday, and days 6, 13, etc are always sunday.
Again though, the problem is this applies to all of the calendars on the form. Do you know of a way where we can only apply this style to one of the date/time fields' calendar? It would be really nice if we could use an attribute on the calendar field to supply a style directly for that field, or perhaps a style field on the dictionary record where we could store this and it would override the style in the form itself.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 12:45 PM
Only way to apply it only to specific fields would be via client scripting. That's not going to work though due to the reasons I mentioned before. I think it will have to be all or nothing for a particular form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2014 02:55 PM
Mark! Thanks for taking the time to reply. Thank you for your response also, that further confirms what we had thought. Okay, so on to other solutions. Thanks again for the help!