18
Views
6
Comments
Solved
How to hide time in Date time input field?
Question
Application Type
Reactive

Hi,

I need to hide time in the date-time input field. I can not change the data type of the variable from DateTime to Date because I am consuming REST API and I don't have access to that.

Looking forward to your reply.

Thank you for your time.

Rank: #297
Solution

Hi Nannu

Maybe you can add a temporary local variable type of Date, And bind it to the input.

And when initial assign

DateVar = DateTimeVar

when use value assign back

DateTimeVar = DateVar 

Kindly Regards

mvp_badge
MVP
Rank: #72

Hi Nannu,

One more solution for the mentioned use-case is to define type property to "date" in the DateTime type Input widget Attributes section as shown below, it will hide the time value in the respective DateTime input field.

Hope this helps you!


Kind regards,

Benjith Sam

Rank: #1281

Hi Benjith,

I was able to hide time with this approach but I can not save the date. I tried debugging it and looked at the value I am sending and found out that it's not changing from its default value.(#1900-1-1 00:00:00#).

Thank you for your reply.

mvp_badge
MVP
Rank: #72

Hi Nannu,

I also had the same observation. As a solution for the mentioned use-case, you could either opt for the approach suggested by @Tom or else If you are willing to follow the approach which I mentioned you will have to add additional code as mentioned-below

  1. Add a JS node in the Save button action flow
  2. The JS node should have 1 input parameter (Text Data type) to pass the DateTime type input widget runtime id and 1 output parameter (Text Data type) to pass the retrieved DateTime input field value
  3. Use the retrieved JS node output parameter for the final entity record insertion/creation operation
  4. Within the JS node, define the below-mentioned JavaScript code to get the respective DateTime input field value

JavaScript snippet:

$parameters.dateTimeInputValue = document.querySelector('#' + $parameters.InputEleId).value;


Hope this helps you!


Kind regards,

Benjith Sam

Rank: #1281

Hi Benjith,

I followed Tom's approach and it's working fine. 

Thank you for your time.

mvp_badge
MVP
Rank: #72

You're welcome, Nannu

Glad to help you :)


Kind regards,

Benjith Sam