Skip to content

Conversation

@nederdirk
Copy link

The min/max options of sfValidatorDate were not normalised in the same way as the input, resulting in the following incorrect behaviour:

$validator = new sfValidatorDateTime([
  'min' => '2018-12-06T09:00:00+00:00',
]);
$validator->clean('2018-12-06T09:59:59+01:00'); // this should throw, because 09:59+01:00 is one minute before 09:00+00:00, but it doesn't

This merge request adds tests for this situation and fixes this behaviour

else
{
$dateMax = new DateTime($max);
$dateMax->setTimezone(new DateTimeZone(date_default_timezone_get()));
Copy link
Contributor

@alquerci alquerci Dec 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @nederdirk,

Here is not an issue with the time zone but the way where the date time are compared.

The proper way to do it is to compare timestamps.

As the timestamp does not depend on the timezone then all issue will be resolved there.

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

Successfully merging this pull request may close these issues.

2 participants