0

I'm working with a datetime field in my model-driven PowerApp (UCI). I'm trying to set the value to the current time using Javascript like Xrm.Page.getAttribute("starttime").setValue(new Date())

With the default control I get: enter image description here which is the correct time and expected but when I switch to the "Time without date" control and run the same JS, I get: enter image description here

which seems to be an offset by 1 hour. I don't know why the control changes the behavior - is this a bug or am I doing something wrong? My field is marked as time zone independent.

Matt Immer
  • 327
  • 1
  • 13

1 Answers1

0

I reproduced the case in my test environment and there is no issue with Time only control. below are the actions taken:

  1. defined two new DateTime fields on the contact entity, The behavior of the two fields is Time-Zone Independent
  2. Add the control "Time without Date" for the second date field on the contact form.
  3. After publishing the customizations set both fields value by executing the below two commands on chrome console Xrm.Page.getAttribute("new_mkdatewithoutc").setValue(new Date()) Xrm.Page.getAttribute("new_mkdatewithc").setValue(new Date())
  4. Both Fields have the same time as appeared in the below screenshot

enter image description here