Browse Source

added note about timezone conversion to DateValidator

fixes #11692
tags/2.0.10
Carsten Brandt 8 years ago
parent
commit
64ed8c9112
  1. 3
      docs/guide/tutorial-core-validators.md
  2. 6
      framework/validators/DateValidator.php

3
docs/guide/tutorial-core-validators.md

@ -149,6 +149,9 @@ specified via [[yii\validators\DateValidator::timestampAttribute|timestampAttrib
[[yii\validators\DateValidator::$timestampAttributeFormat|$timestampAttributeFormat]] and
[[yii\validators\DateValidator::$timestampAttributeTimeZone|$timestampAttributeTimeZone]].
Note, that when using `timestampAttribute`, the input value will be converted to a unix timestamp, which by definition is in UTC, so
a conversion from the [[yii\validators\DateValidator::timeZone|input time zone]] to UTC will be performed.
- Since version 2.0.4 it is also possible to specify a [[yii\validators\DateValidator::$min|minimum]] or
[[yii\validators\DateValidator::$max|maximum]] timestamp.

6
framework/validators/DateValidator.php

@ -123,6 +123,12 @@ class DateValidator extends Validator
*
* This can be the same attribute as the one being validated. If this is the case,
* the original value will be overwritten with the timestamp value after successful validation.
*
* Note, that when using this property, the input value will be converted to a unix timestamp,
* which by definition is in UTC, so a conversion from the [[$timeZone|input time zone]] to UTC
* will be performed. When defining [[$timestampAttributeFormat]] you can control the conversion by
* setting [[$timestampAttributeTimeZone]] to a different value than `'UTC'`.
*
* @see timestampAttributeFormat
* @see timestampAttributeTimeZone
*/

Loading…
Cancel
Save