[Javascript] chopping up a string?

Paul McGuire pmcguire at cguk.co.uk
Mon Nov 17 09:53:43 CST 2003


hopefully none of that will be an issue, I am web enabling a routine which
is currently run on an old green screen system from the 70's. Many of the
staff have been entering the dates in that field in the 1104 or 1206 etc
format for over 10 years and my original attempt to offer them a "proper"
date entry field has bugged them and slowed them down. There stuck in there
ways. I would of argued that they should just relearn a better technique but
our client is adament on doing it this way...

but on the plus side they know exactly what they need to enter in the field
so error checking can be kept to a minimum!

----- Original Message ----- 
From: "Hassan Schroeder" <hassan at webtuitive.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Monday, November 17, 2003 3:40 PM
Subject: Re: [Javascript] chopping up a string?


> Paul McGuire wrote:
>
> > one in the string it may well be that a 1711 or 17 has been
> > entered instead of a "proper date format". So we will assume the string
> > entered needs to be converted - for example 1711 to 17/11/03
> >
> > if we divide the input by 2 we will get the number of dateparts in the
> > string - the number of characters in the string "17" divides by 2 once
so we
> > know there is only a day of month in that string. The 17th. characters
in
> > "1711" divides by 2, 2 times, so we can assume we have a day of month
and a
> > month -17th of November in this example
>
> Is the audience for this function highly technical -- will /always/
> pad single-digit date values with 0? And all from parts of the world
> that format dates dd/mm/yy?
>
> What's `11`? November, the first of January, the 11th of this month?
>
> What's `43`? The third of April or 4th of March, or gibberish?
>
> What's 108? Tenth of August, 8th of October, 8th of January?
>
> You'd probably save yourself a *lot* of coding, and eliminate a
> possible source of user confusion, by having separate `day` and
> `month` fields :-)
>
> FWIW!
> -- 
> Hassan Schroeder ----------------------------- hassan at webtuitive.com
> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
>
>                            dream.  code.
>
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list