-
Notifications
You must be signed in to change notification settings - Fork 2.5k
DateTime form element weird DateInterval step!? #4960
Comments
Did you fix it? |
Start from lower bound valid date rather than base date when iterating through valid date times
The problem with the validation is not infinite, but the validator starts at the base date (which is 1/1/1970 if no min attribute is set) and increments by the step until it reaches or passes the submitted datetime which takes enough time that the script times out. I've created a pull request to help improve this here: [https://github.com//pull/7110] To get round the step validation entirely you can set a step attribute of 'any' to prevent the DateStep validator being added. The default step is 60 seconds for a datetime element WHATWG Spec (There is no datetime element in the W3C spec anymore but time also matches this W3C Time Spec. This suggests that the default should really by a DateStep with a There is an unfortunate side affect of changing the default date interval in that it will no longer be caught by the quicker check that only applies when there is a single interval unit with value 1, so will start to use the longer validation. |
Start from lower bound valid date rather than base date when iterating through valid date times
…on into private method, renaming variables for clarity
Handled in #7110 |
Start from lower bound valid date rather than base date when iterating through valid date times
…inor CS fixes (spacing, braces, etc.)
…efactoring - inlining function call
…efactoring logic for interval max and min diff seconds into private methods
…s - space after comma in parameters
…efactoring `$minSteps` definition logic into own private method
…xtracting logic for `requiredStepIterations` computation into private method, renaming variables for clarity
…efactoring computation of minimum viable interval into a private method
…efactoring step iteration logic for better readability
…oving fallback iteration logic to own private method
…emoving useless `if` block
…enaming variables and private methods for clarity, removing explicit use of `$minSteps`
…enaming private methods to not make them look like getters
…s - aligning assignments
…endframework#4960-date-validation-timeouts-fixes' Close zendframework/zendframework#4960 Close zendframework/zendframework#7110
…endframework#4960-date-validation-timeouts-fixes' into develop Close zendframework/zendframework#7110 Close zendframework/zendframework#4960 Forward port zendframework/zendframework#7110 Forward port zendframework/zendframework#4960
Can someone explain what is the reason behind setting the DateInterval step to a minute instead of a second or even a millisecond in https://github.com/zendframework/zf2/blob/master/library/Zend/Form/Element/DateTime.php#L172 ?
Better, can someone explain why the DateTime element should have a DateStep validator at all?
My problem here, is that with minimal setup, one can never submit a datetime value with seconds != 0, because the step is set to a minute. It just goes into an infinite validation loop.
The text was updated successfully, but these errors were encountered: