Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change proposal #6

Open
Neggia opened this issue Jun 20, 2013 · 0 comments
Open

Change proposal #6

Neggia opened this issue Jun 20, 2013 · 0 comments

Comments

@Neggia
Copy link

Neggia commented Jun 20, 2013

Hello,
I modified function clientValidateAttribute like this to validate sort of a "now" date:

// ...
public function clientValidateAttribute($object, $attribute)
{
if ($this->compareValue !== null) {
$compareTo = $this->compareValue;
//AN81 BEG
// $compareValue = CJSON::encode($this->compareValue);
$compareValue = "(new Date('$this->compareValue'.replace(' ', 'T'))).getTime()";
//AN81 END
}

rule is:

// ...
array('start_date',
// 'ext.date-compare.EDateCompare',
'ext.date-compare.ExtEDateCompare',
// 'compareValue' => 'js:( new Date() ).getTime()',
'compareValue' => date(Yii::app()->params['dateFormat']),
'operator' => '>',
'message' => Yii::t('ui','Begin date must be after now.')
),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant