May 01
kimrvan Using date->parse to test date field entry
May 01, 2013; 15:33
kimrvan
Using date->parse to test date field entry
I'm attempting to use date->parse to test a user's entry in a form's date field, but I'm getting unexpected results.
With:
local('date_start' = date('2012-04-30'))
The following:
#date_start->parse('0000-00-00', -format='%Q')
#date_start
Outputs:
true
0002-11-30
While this:
#date_start->asCopy->parse('0000-00-00', -format='%Q')
#date_start
Outputs:
true
2012-04-30
*This is the result I need.*
But then if the user enters the date in the wrong format, for example:
local('date_start' = date('04-30-2012'))
or omits the day:
local('date_start' = date('2012-04'))
The same code:
#date_start->asCopy->parse('0000-00-00', -format='%Q')
....outputs true, when I'm expecting false.
The docs say, "Returns True if the string parameter is in the proper date format or otherwise False." - but shouldn't it say, "...if the Date Object is in the proper date format..."?
Because if I do this, which is not -format='%Q':
#date_start->asCopy->parse('00-00-0000', -format='%Q')
....the result is still 'true'.
So somewhere I'm going astray - but where?
#############################################################
Attend the Lasso Developer Conference 2013!
Sept 12-14, 2013 in Niagara Falls, Canada
http://www.lassosoft.com/LDC-niagara-falls-2013
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso
Lasso@lists.lassosoft.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>
May 01
kimrvan Using date->parse to test date field entry
May 01, 2013; 15:33
kimrvan
Using date->parse to test date field entry
May 02
Brad Lindsay Re: Using date->parse to test date field entry
May 02, 2013; 09:04
Brad Lindsay
Re: Using date->parse to test date field entry
May 02
Jolle Carlestam Re: Using date->parse to test date field entry
May 02, 2013; 14:06
Jolle Carlestam
Re: Using date->parse to test date field entry
May 02
Brad Lindsay Re: Using date->parse to test date field entry
May 02, 2013; 10:22
Brad Lindsay
Re: Using date->parse to test date field entry
May 02
Jolle Carlestam Re: Using date->parse to test date field entry
May 02, 2013; 14:46
Jolle Carlestam
Re: Using date->parse to test date field entry
May 02
Fletcher Sandbeck Re: Using date->parse to test date field entry
May 02, 2013; 08:01
Fletcher Sandbeck
Re: Using date->parse to test date field entry
May 02
kimrvan Re: Using date->parse to test date field entry
May 02, 2013; 18:42
kimrvan
Re: Using date->parse to test date field entry
May 02
Brad Lindsay Re: Using date->parse to test date field entry
May 02, 2013; 18:44
Brad Lindsay
Re: Using date->parse to test date field entry