BUG Fixed DateTimeField where time value was being parsed incorrectly. #2164

merged 1 commit into from Jul 7, 2013

3 participants


When the current user's locale has AM/PM included, the time field would attempt to parse this value, but before using the same locale parse string, it would run it past the ISO time format string (which ommits the AM/PM). Since the matching was a bit slack, it would think these times were actually ISO, and would parse this in. Of course, the AM/PM would get lost.

This fix changes the parsing mechanism to still do these checks in the correct order, but will only match the ISO format against the presented value if it matches exactly (which is tested by writing the parsed value out and comparing this to the input).

Issue first noted at http://www.silverstripe.org/content-editor-discussions/show/24005


Someone should post that this has been fixed to http://www.silverstripe.org/content-editor-discussions/show/24005 when/if it gets merged


ss23: You need a new avatar image mate. XD

SilverStripe Ltd. member

This seems good to me; first try strictly matching on the field's format, and then try a looser match only if that strict matching fails.

@sminnee sminnee merged commit 0173707 into silverstripe:3.1 Jul 7, 2013

1 check passed

Details default Scrutinizer: No Comments — Travis: Passed
@tractorcow tractorcow deleted the tractorcow:3.1-datetimefield-fixes branch Mar 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment