Introduction to modern Date picker control
Date picker has been around in Power Apps ever since Power Apps came into existence. So although it isn't a new control, the modern version has some minor differences (read: additions and some subtractions) when compared to the classic date picker control. This will probably be one of the shorter modern control blog post as the differences between the classic and modern date picker are very minimal.
New Properties
- Appearance - There are 3 different options:
- 'DatePickerCanvas.Appearance'.FilledDarker (default)
- 'DatePickerCanvas.Appearance'.FilledLighter
- 'DatePickerCanvas.Appearance'.Outline
- ValidationState - There are 2 options:
- 'DatePickerCanvas.ValidationState'.None (default)
- 'DatePickerCanvas.ValidationState'.Error (it adds a red border around the date picker control, you can base it on certain condition)
Renamed Properties
-
- SelectedDate - This is the same as the DefaultDate property of the classic control.
- StartDate - This replaces the StartYear property. Example:
Date( 2025, 1, 1 )
- EndDate- This replaces the EndYear property.
- Placeholder - This is the same as InputTextPlaceholder to show some text when no date is selected.
Some of the properties to style the date picker are gone like IconBackground and IconFill. This might seem a bit crippling to some makers, but trust me, losing some of these properties has been a blessing for me. Lack of these properties helps ensure that the controls look neat and clean.
Using modern Date picker control
The one property that some of the modern controls have lost in comparison to their classic versions is the Reset property. I do miss it at times. I used that property to reset controls to their default values using a variable. Now that the Reset property isn't there anymore, you can still reset controls by using the Reset function. To learn more about the Reset function, click here.
Stay tuned for the remaining modern controls!
To read the official documentation of modern controls, click here.