Handling Dates and Times

When using the date, time or date & time fields, it can be sometimes tricky to work out how the fields work. This topic is to handle any questions you may have.

How the format is used

The definitive guide on moment.js formatting is in the moment.js docs, however this is custom-wizard-specific explaination of how that applies, and a place for any questions about these custom wizard fields.

In the custom wizard code, the format you enter in the format input for a field is applied when the user updates the relevant field.

For example, if a time field format is set to the moment.js representation of an ISO 8601 date:

YYYY-MM-DDZHH:mm:ssZZ

If the user enters the time 07:00 in the time input on the 26th of November in the timezone of GMT+11 (Australia's east coast, where I work from), the value that will be saved with the user's submission will be

2020-11-26+11:0007:00:00+1100

In other words, moment.js will automatically fill out the date and timezone parts of the full ISO 8601 time according to what the user's browser settings (i.e. when and where the user is).

Pro Tip: if the format field is empty moment.js will automatically convert the input to an ISO 8601 string.

To further demostrate, if the format for the time field were changed to

h:mm a

and the user entered 07:00 again, the time saved would be

7:00 am

If you have any more questions about how the format is used to handle date and time inputs, please post below

Angus, is there a way to pull data from a calendar date and use it separately within the composer

Right now, I have the user enter the date, a text field for the month, a date field for 1 week before the date entered.

For example, user enters date (format changed to MM/DD/YY). let's say 05/23/22

In the post title, I want to simply have it say the Month, for example wizard runs, title will result as:

Meeting in (field result:) Denver, May 2022.

Within the post, I want it to parse the data and display:

  • "23-May" in some places
  • May

Then I want it to subtract 1 week from the date, and post the previous Monday (7 days prior) to selected date. to display

  • "16-May"

Is there a way to do this from one date field, or do I just have to stick with requiring the things be entered separately in the wizard