On Wed, Jul 28, 2010 at 11:08 AM, Jon Bennett <[email protected]> wrote:
> try:
>
> public function compareDates()
> {
> return ($this->data[$this->alias]['start_date'] <
> $this->data[$this->alias]['end_date']) ? true : false;
> }
>
> var $validate = array('start_date'=>array('rule'=>'compareDates'));
You'll need to transform the dates into an integer first:
public function compareDates()
{
return strtotime($this->data[$this->alias]['start_date']) <
strtotime($this->data[$this->alias]['end_date']);
}
Also, note the ternary operator isn't strictly required because
lessthan returns a boolean..
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en