If the user inputs only 2 digits, should I assume that they mean 19XX?

I have inline validation that validates a given range (eg 1900 - 2014), but if they type in 13, does it mean 2013 or 1913.

Some of the fields will be birthdays of family members, so it could be anything.

I want to avoid using text because we'll have to translate it.

  • 7
    Simple solution: force a 4-digit year. – Evil Closet Monkey Jun 25 '14 at 16:23
  • Suggested alt. Question: When can we assume that a 2 digit year means 20XX? – Clay Nichols Jun 25 '14 at 16:25
  • 1
    You could always detect when the user has typed a two digit number that is not 19 or 20, and throw up a dialogue asking 'Which Century?'. Seriously though, I agree with @EvilClosetMonkey, a 4 digit year is simplest option – jammypeach Jun 25 '14 at 16:35
  • @EvilClosetMonkey, how would you would force 4-digit year with keeping the validation on the client side and without using text? – alanj Jun 25 '14 at 22:36
  • 1
    You are correct that just adding a red border (for example) would not be enough. Errors need words. If you are wanting to make sure the user enters a 4-digit year you will need an error that displays text of some sort. Well formatted errors are an important part of UX and words are an important part of well formatted errors. – Evil Closet Monkey Jun 26 '14 at 16:25

I would feel relatively safe in assuming that any 2 digits that are equal to or less than the last 2 digits of the current year are describing the current year. So today, it would be numbers 00-14. There is a small chance that there are people 100+ years old that will be excluded but in today's world, when I say "back in '07" I mean 2007 and not 1907 so those people will most likely input the full year.

That said, this ambiguity should be solved another way if possible. Make it clear that the entire year should be entered. If you must "auto-complete," the 4-digit year should show up immediately as a soft confirmation that you understood which of the centuries they meant.

  • I ended up doing it @user47924's way, if somebody puts in 07, it appends 20, if somebody puts in 84, it appends 19. But you can still type in 1907 or 2084 if needed. – alanj Jun 25 '14 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.