Custom formula for Date

I tried to find a solution to this to no avail.

How do I display the date from a custom formula correctly?

OSH-Dashboard

I would like to display the “contact tracing period” as 14 days before the date of positive result until the date of positive. This is displayed as a text field in a screen. In my custom formula, I set “date of positive” - 14

Using custom formula, the output becomes a number 18900. How do I make the output display properly as a date instead of a number?

Hi @ianbong90 ,

Put that number into date property in users collection, so you can show it as date.

Do you mean to create multiple steps? There needs to be action from end user first to calculate the number, before converting to date?

I don’t really understand, sorry, could you please explain it more?

  1. Add 2 date properties in users collection, call them start date and end date, so you can later access them with logged in user in magic text
  2. you can use form to ask user to choose these dates, have an update action before or after the submit to manipulate the date
  3. if you have date in number format, you can convert them by update action to those dates in step 1, so it become date that you can format as date.

Use update rather than custom formula.

1 Like

The start and end dates shouldn’t be shown to the user. The only input user should have is “positive result” and “last working date”

If it is optional for your use case, update them before showing to users.

But I guess what you need is just conversion from number to date.

1 Like