Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » RADICORE Suggestions » date validation
date validation [message #70] Mon, 12 June 2006 21:06 Go to previous message
semcycle is currently offline  semcycle
Messages: 8
Registered: June 2006
Location: Michigan, USA
Junior Member
it would be nice to have support for the US m(m)/d(d)/yy(yy) date format as well. for now i have just hacked std.datevalidation.class.inc as follows

function getInternalDate ($input)
// convert date from external format (as input by user)
// to internal format (as used in the database)
{


// ************** this part changed from
/*
// look for d(d)?m(m)?y(yyy) format
$pattern = '(^[0-9]{1,2})' // 1 or 2 digits
. '([^0-9a-zA-Z])' // not alpha or numeric
. '([0-9]{1,2})' // 1 or 2 digits
. '([^0-9a-zA-Z])' // not alpha or numeric
. '([0-9]{1,4}$)'; // 1 to 4 digits
if (ereg($pattern, $input, $regs)) {
$result = $this->verifyDate($regs[1], $regs[3], $regs[5]);
return $result;
} // if
*/

// ****************** changed to

// change to m/d/y format for US users

// look for m(m)?d(d)?y(yyy) format
$pattern = '(^[0-9]{1,2})' // 1 or 2 digits
. '([^0-9a-zA-Z])' // not alpha or numeric
. '([0-9]{1,2})' // 1 or 2 digits
. '([^0-9a-zA-Z])' // not alpha or numeric
. '([0-9]{1,4}$)'; // 1 to 4 digits
if (ereg($pattern, $input, $regs)) {
$result = $this->verifyDate($regs[3], $regs[1], $regs[5]);
return $result;
} // if

maybe somewhere along the way there could be some user preference settings such as date format, time zone etc ?



Sem Abrahams
www.semcycle.com
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Date picker
Next Topic: Traversing subtrees
Goto Forum:
  


Current Time: Sat Nov 23 12:35:03 EST 2024

Total time taken to generate the page: 0.01159 seconds