cancel
Showing results for 
Search instead for 
Did you mean: 

Allow date picker to select no date

If a date picker is linked to a date column in a data source that is non mandatory, you can set a date but can't then clear it again. The only way is to remove it in the SharePoint list directly.  

Status: New
Comments
Enigmatheatre
Advocate I

Can you not set it to Blank()?

AndyT
Regular Visitor
No, if you clear the date and save it doesn't write back to the SharePoint list
seraph787
Advocate III

This is true of Excel data sources, too.

 

I find that in most of my apps, this kind of functionality is necessary. Pretty much any time you have a date picker (unless it's for a date of birth), you need to be able to clear the date entirely.

 

I am trying so many workarounds but those workarounds have ripple effects that destroy other functionality within the app and I'm coding in circles.

 

Strangely enough, datepickers were completely ignored in the null/blank values blog post at the end of March.  

https://powerapps.microsoft.com/en-us/blog/new-feature-error-handling-and-writing-null-values-to-dat...

Anonymous
Not applicable

I've created a PowerApp that has multiple datepicker controls.  This is a training request form.  I want the trainer to be able to choose a toggle to choose which of the submitted dates that person's training is scheduled, fill the Control for "Approved Training Date" with the date chosen.  I have done all of that, but if the Trainer wants to "Clear Out" the training dates, they cannot delete the Date from the field. 

 

The goal was to on each toggle, "OnUncheck" set the "Approved Training Date" to blank or Null.  I have not been able to figure it out, and this thread looks like the appropriate spot to add my vote!

AndreaChunn
Regular Visitor

I cannot get a the date time picker to get a Null datetime2 to save to sql, this is essential for our app

Django
MVP
As a workaround I have set the default date of date pickers to the last record of their own collection. Clearing the collection of that date picker (which can be done in any OnSelect / OnChange / etc action) will empty the value in the date picker. Combined with some if-statements this could be workaround for most scenarios. (It even gives you the flexibility to open the date picker in a specific month with a nice ClearCollect-formula in the OnSelect property of the Date Picker)
Anonymous_Hippo
Super User

Dear Powerapps Dev team if a user has a form/gallery  with multiple date picker - it is actually cumbersome to add a reset button for each of these date pickers. Please have an option to clear the date within the date picker control !

Here2Cre8
New Member

would it somehow be possible to set the date to 00.00.000 or similar?

Or could you Django explain in detail, how you build your solution?

Django
MVP

Can't believe that this is still an issue...

@Here2Cre8 I could create a small instruction if still relevant: the most simple option is a contextual variable:

  1. Add a Date Picker control with OnChange to UpdateContext({varcDateSelected:Self.SelectedDate})
  2. Add a Cancel Icon with OnSelect to UpdateContext({varcDateSelected:Blank()})
  3. Use the varcDateSelected variable when saving / patching

Django_0-1663579568901.png

Now you can additional logic to the screen and other controls to empty the date picker when needed.

 

Another approach would be to create a component that replaces the default date picker. A quick search led me to: Reusable Revamped Date Picker Control - Power Platform Community (microsoft.com).