Re: Requiring a date be entered as mm/dd/yy on a form field.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On 2009-06-15, Dr J R Stockton <reply0925@xxxxxxxxxxxxxxxxxx> wrote:
In microsoft.public.scripting.jscript message <d6-dnbQX5JdW0ajXnZ2dnUVZ_
r9i4p2d@xxxxxxxxxxxxx>, Sun, 14 Jun 2009 21:17:30, Conrad Lender
<crlender@xxxxxxxxx> posted:
On 14/06/09 18:44, Dr J R Stockton wrote:
2) We've already established that client-side checking is not enough to
completely validate a date entered in this format.
It can verify that an mm/dd/yy string is compatible with the Gregorian
Calendar, and if appropriate whether it is in an acceptable range. It's
much harder to determine whether it is the date that the user ought to
have intended to put.

The question at hand it not whether the user entered what they wanted but
whether they entered it in the right format. A regular expression cannot
confirm that for dates within the first twelve days of a month.

I have read of a case where, in August of year YY, an American ran into
difficulties with a European visa stamped as expiring 10/06/YY - or
something like that. I expect that nowadays YYYY-MM-DD is used for
European numeric dates in an international context.

There are still a huge number of dd/mm/yy dates out there and these types
of errors are extremely common. People who do not have to work with other
cultures often have difficulty even comprehending internationalizaion
issues. Programmers without intercultural background have little ability
to test the assumptions of their code against the range of
internationalized possiblities because their assumptions are still based on
their experiences.

For the case where the person entering the date is interested in getting
it right and is not a mere key-puncher, there is one further thing that
can easily be done and will cause some input errors to be corrected :
after the date has been entered (i.e. onChange), cause the day-of-week
to appear next to it. If the user is not a mere copyist but a generator
of the data, he will often know the day of week of the intended date.
That's an interesting idea for dates in the near future or past, but not
very useful for anything else (birth dates, invoice dates, etc). It also
has a 14% false positive rate.
For random input. For a common case of a single digit being off by one,
except that it can only tell months 2 & 3 in leap years. I think it is
trustworthy. It will also do well on transposing an adjacent digit
pair.

Your method is no doubt great for confirming typos type errors and I would
encourage people to use it for that reason alone(where applicable).
I would not use it as my only means of verification of the entered are
available which are clearer, do not require active user action, do not
require javascript where it may not be available, and are universally
applicable to all dates.
.



Relevant Pages

  • Re: Formatting output
    ... I am trying to do formatted output of single digit decimals. ... //and my attempt to format the output ... You write a string; the third parameter is optional and is the number of bytes to write. ... You need fprintf() instead. ...
    (alt.php)
  • Re: fixing time column
    ... column the single digit hours stay single digit when they should be padded ... When I move the cursor over the cell with "8:03" the cell in the formula bar ... I want to format times with single digit hours (like ... > Tracey wrote: ...
    (microsoft.public.excel)
  • Re: Formatting output
    ... I am trying to do formatted output of single digit decimals. ... //and my attempt to format the output ... You write a string; the third parameter is optional and is the number of bytes to write. ... You need fprintf() instead. ...
    (alt.php)
  • Re: Formatting output
    ... I am trying to do formatted output of single digit decimals. ... //and my attempt to format the output ... You need fprintf() instead. ... Why would it be an undefined function? ...
    (alt.php)
  • dang cell format
    ... I'm trying to set an Excel cell format like I can do in Access to prevent ... input errors. ... Cell input is 1234-123-1234-123, that's to say, non-sequential numbering but ...
    (microsoft.public.excel)