cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TimW
Helper II
Helper II

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
Helper II
Helper II

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
Helper II
Helper II

Quick runthrough of the problemQuick runthrough of the problem

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 .....

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.

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.

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.

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

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?

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,425)