#6084: The function dateTime should allow a user specified separator for time as
well as date
    Reporter:  k00k       |          Type:  Bug    
      Status:  new        |      Priority:  Medium 
   Milestone:  1.2.x.x    |     Component:  General
     Version:  1.2 Final  |      Severity:  Normal 
    Keywords:             |   Php_version:  n/a    
Cake_version:             |  
 == What I did: ==

 I used the $form->input helper to create 'datetime' select dropdowns.

 echo $form->input(
                                 'div' => false,
                                 'class' => 'add',
                                 'label' => array(
                                         'class' => 'basiclabel',
                                         'text' => 'My Date and Time'
                                 'type' => 'datetime',
                                 'minYear' => '2009',
                                 'maxYear' => '2011',
                                 'separator' => '',
                                 'selected' => strtotime('tomorrow 7pm')

 Please note that I supplied the 'separator' attribute as:
 'separator' => ''
  to remove the default separator of - (dash)

 == What I expected to happen: ==

 I expected it to remove any separators from the returned string.

 == Why it didn't meet my expectations: ==
 It worked as expected for the '''date''' portion of datetime, but it
 didn't do anything for the '''time''' portion, the : (colon) was still in
 place between Hours and Minutes. After reviewing the offending code, I see
 that the : (colon) is actually hardcoded when the time is built for

 IMO, this would be better if time allowed for its own separator character;
 rather than the default separator as dates and times are typically
 separated with different characters.

 Here's proof of the hardcoded colon in the time string:

 == Possible fix: ==
 Instead of hardcoding the : for separating the time pieces, allow this to
 be user-supplied in addition to the standard/default separator. It should
 not be the same as $separator because that would then not allow for
 select/date separators and time separators to differ.

 == Considerations: ==
 As I've not had time to research how this possible fix might affect other
 form helpers, there may be a better and less-invasive solution.

Ticket URL: <https://trac.cakephp.org/ticket/6084>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to