Only change date to beginning of month if it isn't nil.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7027 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper
2007-06-15 01:58:32 +00:00
parent 594581685e
commit 1ddaec1e68

View File

@@ -389,7 +389,7 @@ module ActionView
# If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are valid
# (otherwise it could be 31 and february wouldn't be a valid date)
if discard[:day] && !discard[:month]
if datetime && discard[:day] && !discard[:month]
datetime = datetime.change(:day => 1)
end