cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TimW
Level: Powered On

Bug: Possible cause of mystery date problems: Time not midnight in DataCard DatePicker.SelectedDate

I have a form with a DataCard connected to a SharePoint list with a date time column. I was having some problems with the date/time being stored, I thought it was time zone related at first. However, I found that the value in the DateValue control SelectedDate also contains the time by creating a label with this formula:

Text(DateValue8.SelectedDate, ShortDateTime24)

This is a problem because the standard (locked) update formula is this:

DateValue8.SelectedDate + Time(Value(HourValue8.Selected.Value), Value(MinuteValue8.Selected.Value), 0)

 This means the time is added on twice! Has anyone else seen this behaviour?

20 REPLIES 20
TimW
Level: Powered On

Re: DataCard - Time is not midnight in DateValue.SelectedDate

I guess I should put in my work around - I set the DefaultDate in the Date Picker to this to remove the time part:

DateValue(Text(Parent.Default, ShortDate, "en-UK"), "en-UK")
TimW
Level: Powered On

Re: Possible cause of mystery date problems: Time is not midnight in DataCard DatePicker.SelectedDat

PowerApps DatePicker problem.gifQuick runthrough of the problem

James_Hellfeier
Level: Powered On

Re: Possible cause of mystery date problems: Time is not midnight in DataCard DatePicker.SelectedDat

I was having a similar problem with storing incorrect DateTime values and having it not be a timezone issue.

 

https://powerusers.microsoft.com/t5/General-Discussion/Now-Bug-in-Online-Developer/m-p/182621#M60223

 

Microsoft Tech's solution? Remake it until it's no longer an issue .....

TimW
Level: Powered On

Re: Possible cause of mystery date problems: Time is not midnight in DataCard DatePicker.SelectedDat

This was in a fresh test app I made just to show this problem 😕

I also tested it with a date picker not in a form and it didn't seem to have the same issue, might be some kind of type coercion problem as it gets its value through the parent data card rather than directly from the data source.

James_Hellfeier
Level: Powered On

Re: Possible cause of mystery date problems: Time is not midnight in DataCard DatePicker.SelectedDat

Same here when I did some digging. The Date Picker was fine and dandy working on its own, however, once I insterted in into a Form times became incosistent.

 

It shows the correct time in the App, even the Form Updates are showing the correct time, however it's still sending my SQL Database inconsistent times that vary wildly from the actual time that it is.

 

Thing is, it's only one of my apps that this has been an issue for. Other apps I've been developing haven't run into this problem with Form Times sending data to my Database ... at least not yet.

TimW
Level: Powered On

Re: Possible cause of mystery date problems: Time is not midnight in DataCard DatePicker.SelectedDat

If you still have the app try putting in a couple of labels set to this - obviously put the appropriate control names in!

Text(DateValue8.SelectedDate, ShortDateTime24)
Text(Date1_DataCard2.Update, ShortDateTime24)

The first one will tell you if the date picker is incorrectly storing the time, if it's OK it will show midnight. The second shows what will be sent to the database.

James_Hellfeier
Level: Powered On

Re: Possible cause of mystery date problems: Time is not midnight in DataCard DatePicker.SelectedDat

Ahhhh my man.

 

Here is my date card with this morning's date selected : 11/21/2018 07:16

 

cap1.PNG

 

And  here would be the couple of labels you mentioned (First label on Left, second label on Right). It's picking Non-Midnight as the Date value when, as you stated, it should be picking up Midnight and then adding the 07:16 onto 00:00 in the Update.

 

cap2.PNG

 

Note : The first time I loaded up the app, the first label was picking up the correct Midnight Date value : 11/21/2017 00:00 and Updating the correct DateTime : 11/21/2018 07:16

 

After reloading the app to try it again, I ran into that 07:16 -> 14:32 issue

 

 

Also ... just noticed you were the one who linked me here from my previous thread ... my bad Smiley Wink

TimW
Level: Powered On

Re: Possible cause of mystery date problems: Time is not midnight in DataCard DatePicker.SelectedDat

Yeah, I admit I was fishing for an ally on this! Good to see it reproduced. It's the same here, it's OK when the screen first comes up but as soon as you set the selected item in the form it goes wrong - even if it's the same record.

 

Any idea how to get the attention of someone who can fix it?

James_Hellfeier
Level: Powered On

Re: Possible cause of mystery date problems: Time is not midnight in DataCard DatePicker.SelectedDat

In theory a Microsoft Tech should eventually see this? I tried reporting this as a bug as you already saw and they kind of wrote me off, so hopefully someone sees this soon!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,780)