Like the idea,
Couple of questions...
What would happen if the string contained a matching pattern twice or me, which would be 'returned', also does this allow the rest of the string to be pretty much junk.
(haven't had time to test patch as miles from a computer)
--
James Butler
Sent from my iPhone
Hi!
As I previously noted, in DateTime module there's no way to make
DateTime format parser to parse the string if the string contains more
data that the format supplies - i.e. if you need 'Y-m-d' and you have
string '2010-11-02 12:30' - you can't make DateTime accept it without
pre-parsing. The attached patch adds format character '+' that
implements that - i.e., if you use format 'Y-m-d+' then the string
'2010-11-02 12:30' will be parsed successfully, as well as '2010-11-02'
and string with anything following the date.
The character would make the format 'lenient' when used in any position
in the string, doesn't have to be at the end.Any objections? If not, I'll add some unit tests and commit it.
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227<lenient_date.diff
Hi!
What would happen if the string contained a matching pattern twice or
me, which would be 'returned', also does this allow the rest of the
string to be pretty much junk.
Yes, the rest of the string (i.e. everything after the format was
matched, while ignoring +) can be anything. I.e., as soon as the
requirements of the format (like "Y-m-d") is satisfied, it doesn't
matter what else the string has.
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227