Fluentui: Calendar / DatePicker: Add possibility to disable weekend days

Created on 31 May 2019  路  4Comments  路  Source: microsoft/fluentui

Describe the feature that you would like added

I need a way to prevent from selecting weekend days and I couldn't find anything helping me in regard to this. There is a property restrictedDays, but that would be very hard to fill with all weekend days, since I don't know the currently visible month / year and hence would need to add every weekend for the future and past 100 years or so. If there was an event that is triggered every time the displayed month (including the resp. year) changes, this would help me in regard to that.
Another way would be the possibility to provide a callback, that can return true / false for days to enable / disable, just as proposed in #3529 (which was closed back then ...). Personally I'd prefer the last option, since it's the most flexible and, in regard to React, the most reactive.

What component or utility would this be added to

Calendar

Have you discussed this feature with our team, and if so, who

nope

Additional context/screenshots

I guess this should be clear without a screenshot ;-)

Calendar Backlog review Feature

All 4 comments

Hi @alex3683, thanks for submitting this feature request! I can add this to our backlog review. Is this something that you would be willing to help contribute to?

@lorejoh12, do you know if this is possible with our current implementation? I couldn't find an easy way to implement this.

We discussed creating an interface for the the RestrictedDates property, but never got around to actually doing it. I'd imagine we can change it from an array of Dates to a new Restrictions interface, which we can define as:

interface Restrictions {
    dates: Date[];
    daysOfWeek: DayOfWeek[]; // one of these two additions, or maybe both?
    disableDayIf: (day: Date) => Boolean;
}

or whatever else we think is necessary here.

This would also give us some ability to add additional logic in the future, as well as wrap the "minDate" and "maxDate" into this property in the future as well.

We can add this idea to our backlog and discuss it during our next team sync (two weeks from now).

If this is work you're willing to contribute to, let me know! Especially if this is a time-sensitive feature for you. Otherwise, I'll follow up when we discuss this.

@leddie24 @lorejoh12 As much as I'd love to contribute to this and Office UI Fabric in general, I have to be honest and admit, that I wouldn't have the time to do this properly :-/ This is not yet critical, but would be great if that was available within the next 3 month or so (just to give a vague time frame).

Regarding your implementation idea: If I'd implement more than one of the properties of the Restrictions interface, would they be additive or would there be some priority for a property used exclusively? Personally I'd go for the first way, because at least to me it seems less confusing.

On the other hand, wouldn't it be sufficient to just support the callback logic? Anything else could easily be implemented with that. Just mentioned as a thing to discuss ;-)

Are there any updates on this? This would be an awesome feature.

Was this page helpful?
0 / 5 - 0 ratings