Don't miss out Virtual Happy Hour today (April 26).

Try our conversational search powered by Generative AI!

Time picker field giving the 12:00 AM if we are not selected anything.

Vote:
 

I have created the StartTime field by using the below code. Provided the required details, and not selected the StartTime field value then published the page. But on the publishing page startTime field value showing 12:00. How can we show empty/null if not select the StartTime.

[ClientEditor(ClientEditingClass = "dijit/form/TimeTextBox")]
        public virtual DateTime StartTime { get; set; }

.CSHTML

<p>@Model.CurrentPage.EventEndTime.ToString("hh:mm tt")</p>

#261491
Sep 02, 2021 9:47
Vote:
 

Try changing the type of the property to string

#261495
Sep 02, 2021 11:12
Vote:
 

Have you tried using a nullable DateTime?

public virtual DateTime? StartTime { get; set; }
#263098
Sep 14, 2021 16:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.