This project is archived and is in readonly mode.

#1289 ✓committed
Tor Erik

Regression in date_select between 2.1.1 and 2.2 RC1

Reported by Tor Erik | October 29th, 2008 @ 02:54 PM

Date_select blows up when given certain options on Rails 2.2 RC1. Attaching test which passes on 2.1.1 and fails on edge/2.2 RC1.

Tor Erik

Comments and changes to this ticket

  • DHH

    DHH October 30th, 2008 @ 10:39 AM

    • Milestone cleared.
  • Bernardo Padua

    Bernardo Padua November 4th, 2008 @ 02:44 AM

    • Tag changed from 2.2.rc1, actionview, date_helper to 2.2.rc1, actionview, date_helper, patch

    This bug occurs whenever trying to use the +date_select+ and +datetime_select+ helpers with a date / datetime attribute that has a nil value (eg.: it wasn't set yet), and you configure the helper to discard the day.

    @@@ Ruby <%= form.date_select 'end_date',

    :discard_day => true,
    :include_blank => true %>
    This simple patch fixes it. It includes the tests written by Tor Erik, with a minor modification to make they pass as expected.
    It breaks current apps and is hard to debug so I think it should be applied ASAP, before the rails 2.2 release.
  • Bernardo Padua

    Bernardo Padua November 4th, 2008 @ 02:46 AM

    Sorry for the ugly formatting, I don't think code highlighting worked very well.

  • Repository

    Repository November 4th, 2008 @ 05:21 PM

    • State changed from “new” to “committed”

    (from [b2cd318c2e3f4d19813a5c62903319a6683aa561]) Fix regression bug that made date_select and datetime_select raise a Null Pointer Exception when a nil date/datetime was passed and only month and year were displayed [#1289 state:committed]

    Signed-off-by: David Heinemeier Hansson

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=""></a>

Referenced by