This project is archived and is in readonly mode.
datetime_select and select_datetime inconsistent for various options
Reported by Neeraj | April 18th, 2010 @ 03:16 AM | in 3.0.2
I tested following case with edge 2-3-stable branch.
discard_hour => true
datetime_select #=> yyyy month day
select_datetime #=> yyyy month day minutes
result is inconsistent
discard_minute => true
datetime_select #=> yyyy month day hours
select_datetime #=> yyyy month day hours
result is consistent
discard_second => true
datetime_select #=> yyyy month day hours minutes
select_datetime #=> yyyy month day hours minutes
result is consistent
ignore_date => true
datetime_select #=> hours minutes
select_datetime #=> yyyy month day hours minutes
result is inconsistent
discard_month => true
datetime_select #=> yyyy hours minutes
select_datetime #=> yyyy day hours minutes
result is inconsistent
I have not listed a few more cases where the result is inconsistent.
For the methods datetime_select and select_datetime which are mirror image methods, the expected behavior should be as consistent as possible.
Please let me know if it is something that should be fixed. I can put in a patch if I get a go ahead.
I actually wanted to fix ticket #1004 https://rails.lighthouseapp.com/projects/8994/tickets/1004-datetime... . However if this inconsistency is removed then code would be more streamlined and it would easier to patch ticket #1004.
Comments and changes to this ticket
- 
         Santiago Pastorino April 22nd, 2010 @ 08:18 PMWhat about this on 3.0?, can you provide the same information for 3.0? 
- 
         Neeraj Singh April 22nd, 2010 @ 09:52 PMFor all the below mentioned options, result between datetime_select and select_datetime is consistent in rails3. Nice work rails team. discard_hour => true 
 discard_minute => true
 discard_second => true
 ignore_date => true
 discard_month => true
- 
         Neeraj Singh April 22nd, 2010 @ 09:53 PMNow that it it is clear that this issue is only relevant to 2.3.x branch, if it is something that should be fixed then do let me know. I do see that priority is low. However I looked at code and could provide a patch for 2.3.x. 
- 
         Santiago Pastorino April 22nd, 2010 @ 10:55 PM- Milestone set to 2.3.6
- State changed from new to open
- Assigned user changed from Geoff Buesing to Santiago Pastorino
 Ok Neeraj Singh, please provide a patch with tests ;) 
- 
         Neeraj Singh April 23rd, 2010 @ 09:13 PMHi Santiago, My previous report on everything working fine in rails3 was wrong. Sorry I was in the wrong rvm path. Here are the cases where result is inconsistent. I have verified that this case exists in both 2.3.5 and in rails3 edge. discard_hour => true 
 datetime_select #=> yyyy month day
 select_datetime #=> yyyy month day minutesignore_date => true 
 datetime_select #=> hours minutes
 select_datetime #=> yyyy month day hours minutesdiscard_month => true 
 datetime_select #=> yyyy hours minutes
 select_datetime #=> yyyy day hours minutesWorking on it. First I will have a patch for 2.3.x and later for rails3. Sorry about the mistake in the previous report regarding rails3. 
- 
         Santiago Pastorino April 23rd, 2010 @ 09:30 PM- Milestone cleared.
- Tag changed from 2.3.6 to 2.3.6, 3.0, date_select
 Can you provide test cases and/or patches for this cases?. 
- 
         Neeraj Singh April 29th, 2010 @ 06:14 AM- Tag changed from 2.3.6, 3.0, date_select to 2.3.6, 3.0, date_select, patch
 Attached is a patch against rails edge which brings more consistency between date helper methods. without patch ============= no options f.datetime_select : 2010 April 29 - 04 : 21 select_datetime : 2010 April 29 04 21 ( no dash no colon) :discard_hour => true f.datetime_select : 2010 April 29 select_datetime : 2010 April 29 31 :discard_month => true f.datetime_select : 2010 - 04 : 21 select_datetime : 2010 29 04 21 with patch ============= no options f.datetime_select : 2010 April 29 - 04 : 21 select_datetime : 2010 April 29 - 00 : 21 :discard_hour => true f.datetime_select : 2010 April 29 select_datetime : 2010 April 29 :discard_month => true f.datetime_select : 2010 - 04 : 21 select_datetime : 2010 - 00 : 21 Similar type of inconsistencies have been fixed for date_select and time_select. If you want to test some of these then you can put following code in your erb . 
 http://gist.github.com/383178formatting was getting messed up hence I used gist. 
- 
         Repository April 29th, 2010 @ 12:44 PM- State changed from open to resolved
 (from [68c96fad55fb13164e339426d7f1cbc88d4ccc8b]) Fix form builder and form helpers inconsistencies [#4432 state:resolved] - datetime_select and select_datetime should be consistent as much as possible
- date_select and select_date should be consistent as much as possible
- time_select and select_time should be consistent as much as possible
 Signed-off-by: José Valim jose.valim@gmail.com 
 http://github.com/rails/rails/commit/68c96fad55fb13164e339426d7f1cb...
- 
         Santiago Pastorino April 29th, 2010 @ 03:27 PM- Milestone set to 2.3.6
- State changed from resolved to open
 Well done Neeraj Singh can you do the same for 2.3 stable? 
- 
         Neeraj Singh April 29th, 2010 @ 07:55 PMHey Santiago, Attached is patch back ported for 2-3-stable branch. 
- 
         Santiago Pastorino April 29th, 2010 @ 08:18 PM- Milestone cleared.
- State changed from open to resolved
 Neeraj sorry, i didn't know that José said to you to not do the backport. 
 Perhaps on 2.4 this could be fixed :P.
- 
         Neeraj Singh April 29th, 2010 @ 08:22 PMAttached is patch against rails3. I forgot to remove a statement from the last patch. 
- 
         José Valim April 29th, 2010 @ 09:27 PM- State changed from resolved to open
- Assigned user changed from Santiago Pastorino to José Valim
 
- 
         Repository April 30th, 2010 @ 01:28 PM- State changed from open to resolved
 (from [a003a39bac204b6b2d6425fa3c10891a0cf0149a]) removing the extra assignment statement [#4432 state:resolved] Signed-off-by: José Valim jose.valim@gmail.com 
 http://github.com/rails/rails/commit/a003a39bac204b6b2d6425fa3c1089...
- 
         Jeremy Kemper October 15th, 2010 @ 11:01 PM- Milestone set to 3.0.2
- Importance changed from  to Low
 
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 
         4432 
          datetime_select and select_datetime inconsistent for various options
        (from [68c96fad55fb13164e339426d7f1cbc88d4ccc8b])
Fix for... 4432 
          datetime_select and select_datetime inconsistent for various options
        (from [68c96fad55fb13164e339426d7f1cbc88d4ccc8b])
Fix for...
- 
         1004 
          datetime_select to accept :ampm option
        I started working on patch for this issue. However becaus... 1004 
          datetime_select to accept :ampm option
        I started working on patch for this issue. However becaus...
- 
         1004 
          datetime_select to accept :ampm option
        Now that #4432 is resolved, I will take another shot at
t... 1004 
          datetime_select to accept :ampm option
        Now that #4432 is resolved, I will take another shot at
t...
- 
         4432 
          datetime_select and select_datetime inconsistent for various options
        (from [a003a39bac204b6b2d6425fa3c10891a0cf0149a])
removin... 4432 
          datetime_select and select_datetime inconsistent for various options
        (from [a003a39bac204b6b2d6425fa3c10891a0cf0149a])
removin...
 Anil Wadghule
      Anil Wadghule
 Geoff Buesing
      Geoff Buesing
 José Valim
      José Valim
 Santiago Pastorino
      Santiago Pastorino