This is more a personal reference for a small issue I’ve found in the web application framework CakePHP.
When using the Form Helper to output date and time fields on forms, CakePHP automagically creates a <select> for each element of your field ie. day, month, year, hour, minutes, meridian (where necessary).
By default, each <select> is separated by a single character, specifically “-†between date elements and “:†for the time elements.
You can override the separator by setting the optional parameter in the view, eg:
<?php echo $form->input('my_date', array( 'type' => 'datetime', 'separator' => '' )); ?>
However, this is ignored on the time fields which maintains the colon.
To combat this, I’ve had to delve into the Cake library files and update lines 1918-1931 of /cake/libs/view/helpers/form.phpwith the following:
switch ($timeFormat) { case '24': $opt .= $separator . $this->hour($fieldName, true, $hour, $selectHourAttr) . $separator . $this->minute($fieldName, $min, $selectMinuteAttr); break; case '12': $opt .= $separator . $this->hour($fieldName, false, $hour, $selectHourAttr) . $separator . $this->minute($fieldName, $min, $selectMinuteAttr) . $separator . $this->meridian($fieldName, $meridian, $selectMeridianAttr); break; default: $opt .= ''; break; }
Now, the specified separator is applied to the time elements too (hour, minutes and meridian).