Using Advanced Default Dates in Date/Time Form Fields

Written by Brandon on February 4, 2013

Posted in Form Hacks

When working with Date/Time fields on your forms, you may have run into a situation where you wanted to set a default date that was more than just a month, day, and year. Our forms support the ability to enter dates in almost any format, which means we have to run those dates through a date parser. The date parser we use not only supports the standard formats such as 01/01/13, but a large amount of relative dates which I will highlight.

The standard date formats are all supported:


What is more exciting is that we also support relative date formats which allow users to enter a date relative to the time that the form is being filled out:

next Thurday
last Monday

When the user submits the form, the current date is used to evaluate the relative dates. The date ‘next Thursday’ will always been in the context of the week the user filled out the form, not when you created it.

The last date formats we support are calculated dates. With these date formats, you can take the date that the user fills out the form, and add or subtract a time period to it.

+1 day
+1 week
+1 week 2 days 4 hours 2 seconds

As you can see, our Date/Time fields can support some pretty exciting possibilities when using these new date formats. The next time you set a default date/time, experiment with the date formats and see what works best for you because, in addition to the formats highlighted above, the date parser supports a mix of all of these formats.

Questions about this feature? Feel free to leave them in the comments below!