I'm setting up a form that includes two date_popup fields. If I use my machine's default #date_format, 'n/j/Y - g:ia' then the date_convert_from_custom function fails because of the space-hyphen-space. This happens because of this line in date_popup_input_value:
$input = $element['#value']['date'] .(!empty($element['#value']['time']) ? ' '. $element['#value']['time'] : '');
The two halves are being joined with a single space, not ' - '. Date_convert_from_custom() is very strict about requiring the exact separator. Perhaps date_limit_format() needs to remove the hyphen?
Comments
Comment #1
gribnif commentedAnother note. There seems to be a second bug surrounding the 'a' part of my format. date_popup always generates a time with AM or PM, but 'a' means 'am' or 'pm'. Once again, date_convert_from_custom fails because of this.
Comment #2
karens commentedGood catches! I changed the code to convert the date and time separately since we can't know or care how the date parts are connected. And we needed a reverse conversion for the timepicker formats because the timepicker uses 'A' instead of 'a' even if the format is different.
Comment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.