mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fallback_string_to_date sets Date._parse comp arg to true, so that strings with two-digit years, e.g. '1/1/09', are interpreted as modern years [#2019 state:resolved]
This commit is contained in:
parent
6f97ad07de
commit
55d1d12c32
3 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
|||
*Edge*
|
||||
|
||||
* fallback_string_to_date sets Date._parse comp arg to true, so that strings with two-digit years, e.g. '1/1/09', are interpreted as modern years #2019 [Matt Ganderup]
|
||||
|
||||
* quoted_date converts time-like objects to ActiveRecord::Base.default_timezone before serialization. This allows you to use Time.now in find conditions and have it correctly be serialized as the current time in UTC when default_timezone == :utc. #2946 [Geoff Buesing]
|
||||
|
||||
* SQLite: drop support for 'dbfile' option in favor of 'database.' #2363 [Paul Hinze, Jeremy Kemper]
|
||||
|
|
|
@ -201,7 +201,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def fallback_string_to_date(string)
|
||||
new_date(*::Date._parse(string, false).values_at(:year, :mon, :mday))
|
||||
new_date(*::Date._parse(string, true).values_at(:year, :mon, :mday))
|
||||
end
|
||||
|
||||
def fallback_string_to_time(string)
|
||||
|
|
|
@ -34,4 +34,10 @@ class DateTimeTest < ActiveRecord::TestCase
|
|||
topic.bonus_time = ''
|
||||
assert_nil topic.bonus_time
|
||||
end
|
||||
|
||||
def test_two_digit_year
|
||||
topic = Topic.new
|
||||
topic.last_read = '1/1/09'
|
||||
assert_equal Date.new(2009,1,1), topic.last_read
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue