web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Disable Selection of W...
Power Apps
Answered

Disable Selection of Weekends in Canvas App Date Picker

(0) ShareShare
ReportReport
Posted on by 473

I have a requirement to disable selection of weekend dates in Canvas App datepicker control.

In addition, I would need to store all dates belonging to weekends in a collection, so I can skip those dates during Patch() statement.

May I know if the above are possible?

gymcode_0-1706196066902.png

Categories:
  • Verified answer
    vaubeee Profile Picture
    533 on at

    Hey @gymcode! Have a look at @AmDev s solution: DatePicker restrict weekend days (Saturday & Sunday) 

    Hope this helps 👍

     

    ------------------------------------------------------------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

  • ruihaolrh Profile Picture
    473 on at

    Hi @VauBee , thanks for the suggestion. I read the answer, but have some clarifications for @AmDev , which I will post it here as well, if you could answer too. Thank you.

    Referencing to @AmDev's solution , for the following code to be input to Date Picker, I am unable to locate all the fields.

     

    • Onselect: Set(varDate, Self.SelectedDate)
    • DefaultDate: If(Weekday(varDate) =1 || Weekday(varDate) =7, Blank(), varDate)
    • InputTextPlaceholder: If(IsBlank(Self.SelectedDate), Text("DD/MM/YYYY"))


    Below are my findings on the fields that matches, or potentially represents, for both Classic and Modern Datepicker controls.

    1) OnSelect -> Classic (OnSelect) / Modern (SelectedDate?)

    2) DefaultDate -> Classic (InitialPickerDate? Value? Today?) / Modern (SelectedDate?)

    3) InputTextPlaceholder -> Modern (Placeholder?)


    Classic DP Control fields

    1. OnChange
    2. OnSelect
    3. AcceptsFocus
    4. AccessibleLabel
    5. AllowTextInput
    6. ContentLanguage
    7. FillColor
    8. FirstWeekOfYear
    9. Font
    10. FontSize
    11. FontWeight
    12. IconFill
    13. IconSize
    14. InitialPickerDate
    15. MaxDate
    16. MinDate
    17. PaddingBottom
    18. PaddingEnd
    19. PaddingStart
    20. PaddingTop
    21. ShowGoToToday
    22. ShowWeekNumbers
    23. TextColor
    24. Today
    25. Tooltip
    26. Value
    27. DisplayMode
    28. Height
    29. Visible
    30. Width
    31. X
    32. Y

     

    Modern DP Control fields

    1. OnChange
    2. AccessibleLabel
    3. BasePaletteColor
    4. ContentLanguage
    5. EndYear
    6. Font
    7. FontColor
    8. FontItalic
    9. FontSize
    10. FontStrikethrough
    11. FontUnderline
    12. FontWeight
    13. Format
    14. IsEditable
    15. PlaceHolder
    16. SelectedDate
    17. StartOfWeek
    18. StartYear
    19. ValidationState
    20. DisplayMode
    21. Height
    22. Visible
    23. Width
    24. X
    25. Y

     

  • ruihaolrh Profile Picture
    473 on at

    I saw a solution that counts all weekdays between 2 dates, in the following link:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Excluding-weekends-in-date-differences-in-PowerApps/m-p/1966066#M492979

    I am trying to modify it so that it stores all weekend, or weekday dates, so I can avoid Patch() function for those dates.

    With(
     {
     // generate a one-column table of all dates between start date & end date
     varDateRange: ForAll(
     Sequence(dte_EndDate.SelectedDate - dte_StartDate.SelectedDate + 1),
     dte_StartDate.SelectedDate + Value - 1
     )
     },
     If(
     And(
     IsBlank(dte_StartDate.SelectedDate),
     IsBlank(dte_EndDate.SelectedDate)
     ),
     // show nothing if any date pickers are blank
     0,
     // show only dates Monday to Friday and exclude holidays
     CountIf(
     varDateRange,
     And(
     Weekday(Value) in [2, 3, 4, 5, 6],
     Not(Value in 'Holiday Calendar'.HolidayDate)
     )
     )
     )
    )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 283

#3
Mohsin Ali Profile Picture

Mohsin Ali 221

Last 30 days Overall leaderboard