Announcements
I want to limit users to selecting just sundays in a date selector for week date in a canvas app. Can I do that?
@jlindstrom The DatePicker control does not have any ability to restrict days of the week. There's many limitations to datepickers currently...
You could check whether a Sunday was picked using this code.
If(Weekday(DatePicker1.SelectedDate)=1, "Valid date", "Not a valid date")
---Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Alternatively, if you are ready to really dig in, you could build your own date picker control in PCF that allows only the selection of Sundays.
Start with this control from the PCF Gallery and if would just take a few lines of JS validation to prevent selection of any dates that aren't a Sunday (Bonus: it looks a heck of a lot nicer than the OOB date picker). If you've built a PCF before, it should take you no more than an hour.
@cchannon
Is PCF only for model-driven apps?(I feel like this could be built in canvas too. Maybe it would make a good weekend project)
PCF is available for canvas apps in Preview right now. The main limitation you will hit there will be that there is no access to the WebApi, so if you want any custom database operations to happen inside your control, you will need to get creative with outputs and passing values back up to your canvas app to take actions ( pcf assign output params for canvas app operations ) . But overall, I have found it is pretty stable and easy to use. Check the Powerapps pro dev & ISV channel on this community for tons of discussions and resources, plus, I would recommend you take a look at some of the following:
https://docs.microsoft.com/en-us/powerapps/developer/component-framework/create-custom-controls-using-pcf
https://pcf.gallery/
and, if you're going to try to use FluentUI as in the PCF Gallery example I posted above, you will want
https://developer.microsoft.com/en-us/fluentui#/
https://reactjs.org/tutorial/tutorial.html <- Seriously. If you are going to try to use React in a PCF, start here.
Enjoy!
Thanks @mdevaney and @cchannon . I rethought the requirement and what I really need is the Sunday of the week, so I can let the users select whatever date they want to, then use the following in another date field to get the Sunday of the week.
DatePicker1.SelectedDate-Weekday(DatePicker1.SelectedDate,2)
Where should this code be input? Into the "On Select" property of the Submit button?
What about Saturday?
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 490
WarrenBelz 427 Most Valuable Professional
Vish WR 381