What is the best practice for a field that will sometimes be a date and sometimes be a date and time?

Hi Folks!

Would greatly appreciate best practice guidance for the date/time type in AppSheet…

Scenario: An announcement is scheduled for April 2021. Initially the dates are for April 1 - April 30th. As the announcement approaches, we will know the specific date/time.

I feel like this has to be done with 8 different fields but wanted folks feedback to see if there is a more simple way.

Kindly note we need the dates and times for the calendar and for a massive concatenation formula in the background building out a summary statement for an email workflow.

Proposed Fields:

  • Has End Time? [Yes/No]
  • Activity date and time [DateTime]
    • Show if [Has End Time?]=Yes
  • start date [Date]
    • Show if [Has End Time?]=No
  • end date [Date]
    • Show if [Has End Time?]=No
  • hidden start date [Date]
    • IF([Has End Time?]=“Yes”,DATE([Activity date and time]),DATE([start date]))
  • hidden start time [Time]
    • IF([Has End Time?]=“Yes”,TIME([Activity date and time]),"")
  • hidden end date [Date]
    • IF([Has End Time?]=“Yes”,DATE([Activity date and time]),DATE([end date]))
  • hidden end time [Time]
    • IF([Has End Time?]=“Yes”,TIME([Activity date and time]),"")

The Calendar UX is based on the hidden fields.

Is this the best way? Is there an easier way?

I don’t completely understand Scenario, why Start and End Dates would have Times at all nor how Activity DateTime fits into the picture. Could you elaborate a bit more?

Also, what does it mean that “Calendar UX is based on the hidden fields”??

How about just 4 fields; start date, start time, end date, end time?

1 Like

That could work. I still wonder about Activity Date.

If I understand correctly, the idea is to hide the Time component until there is a Time to enter. So how do you tell the app to finally show the Time? I suppose you could have Yes/No column shown only the form that allows the person editing to signal they are ready to enter the Times.

Personally, I don’t like to separate Dates and Times that are meant to be together. For this case I would use a DateTime and set the Time component to 00:00:00. Then simply update the time when ready.

I would then show the Start Date and End Date normally along with a message: “Event Times coming soon!”. I think it’s easier implementation and more valuable to the end user.