Date validation

10 views
Skip to first unread message

John Whish

unread,
Sep 20, 2011, 5:05:55 AM9/20/11
to ValidateThis-dev
Hi all,

As you may know I've been trying to optimise the Javascript and have
tweaked a few of the CSVs. The Unit Tests and Selenium tests are all
passing, but for extra peace of mind, I've been writing QUnit tests as
well.

I noticed that for the server site daterange validator these all work:

<cfset shouldPass = ["1/1/1969","12/31/1968",""31-Dec-68","December
31, 1968","Dec. 31 1968","12/31/68","31/12/1968","1968-12-31"]>
<cfset shouldFail =
["12/28/1969","12/29/1968","1/2/1969","01/02/1969","12/31/1969","2010-12-31","abc",-1]>

For the range: param = {from:'12/29/1968', until:'1/1/1969'}

When I run those against the client side validator (with QUnit), then
these values do not pass (on Safari, IE, Chrome and FF):

1/1/1969
31/12/1968

This also fails on IE and FF (but passes on chrome & safari)

31-Dec-68

1/1/1969, should pass and is a bug. My question is what to do the date
is valid (for the locale) such as "31/12/1968", should VT allow it to
pass client side? As far as I know, the new Date() method does not
support locales, so I don't know how to do this in Javascript.

I'm not so worried about '31-Dec-68' as I think dates should be passed
as either all numeric values (with delimiter) or as a full string, but
I'd appreciate your thoughts.

- John

Bob Silverberg

unread,
Sep 26, 2011, 11:22:38 AM9/26/11
to validate...@googlegroups.com
Hey John,

Thanks for helping out on the mailing list in my absence. I was
actually in your country for three hours on Sept. 16 (at Heathrow).

I'm not sure how to respond to your question. I had never planned on
having to write a lot of JS to support VT, which is why I relied on
the jQuery plugin so much. I suppose we have now changed things so
that we are mostly writing our own JS for the majority of types, but I
don't think we want to go crazy trying to address edge cases. If this
is simply an issue of the client-side code not being set up to support
certain date formats then I think that as long as we support the most
common ones we shouldn't worry about it.

Bob

> --
> You received this message because you are subscribed to the Google Groups "ValidateThis-dev" group.
> To post to this group, send email to validate...@googlegroups.com.
> To unsubscribe from this group, send email to validatethis-d...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/validatethis-dev?hl=en.
>
>

--
Bob Silverberg
www.silverwareconsulting.com

John Whish

unread,
Sep 27, 2011, 6:28:29 AM9/27/11
to validate...@googlegroups.com
Thanks Bob,

I saw you were in Italy - looked nice :) Obviously for sheer beauty
and glamour, then Heathrow is hard to beat!!

I'll stop worrying about US, UK, German date formats then on the client side :)

I've pushed to my qunit branch. I wouldn't mind you having a look. You
can run the qunit tests by calling:
http://localhost/validatethis/tests/qunit/clientsidevalidators.cfm

I've tested against IE9, Safari 5, Chrome 14 and Firefox 6 on Windows
7. I've run the selenium tests and they are all passing so would be
good to test on a Mac as well in case the browser(s) behave
differently.

John Whish

unread,
Sep 27, 2011, 6:39:28 AM9/27/11
to validate...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages