Skip to main content
New Participant
July 8, 2019
Answered

Is there a way to allow for multiple date formats?

  • July 8, 2019
  • 3 replies
  • 928 views

There is a section of my form that asks for a person's date of birth. I would like for the field to allow the date of birth to be entered only in the following formats:

1. m/d/yyyy

2. m/d/yy

The Date Format under Text Field Properties only allows for one to be selected and I was wondering if there was any way to allow for multiple? I would prefer that the date of birth is displayed showing 4 digits for the year but I do not want it to give an error and cause any frustration if it's entered using only 2 digits for the year.

This topic has been closed for replies.
Correct answer BarlaeDC

Hi,

I think you would need to create a custom validation script, that took the value from the field, and checked it matched either of your options.

Regards

Malcolm

3 replies

JoelGeraci
Participating Frequently
July 8, 2019

Allowing either is largely unnecessary. If you did want to allow either, you'd write a validation script that would check if a valid date (in any format) were entered and then a format script to put the entered date into one of the two you'll accept... but in the end, your script will still need to pick one of two as the final format.

BarlaeDC
BarlaeDCCorrect answer
Community Expert
July 8, 2019

Hi,

I think you would need to create a custom validation script, that took the value from the field, and checked it matched either of your options.

Regards

Malcolm

try67
Community Expert
July 8, 2019

How would you know if "18" means "2018" or "1918"?

New Participant
July 8, 2019

This form is used to set up web accounts so we are assuming that the user would be younger than 100.

try67
Community Expert
July 8, 2019

Don't assume anything. You don't know what kind of users you might have or what they might want to do.

Maybe someone is creating a website for their grandparent (born in 1918), or their child (born in 2018)?

Millions of dollars were spent on trying to fix the Y2K bug and you want to intentionally introduce it to your forms? That's a bad idea. Just have the users spend the extra half second it takes to type in those two numbers. It might save you a lot of time and effort in the future (and the present, as you won't have to start writing custom format and validation scripts).