From f4bd67b687ba1a2a6f907939ea44717b41a505e1 Mon Sep 17 00:00:00 2001 From: edogawaconan Date: Thu, 5 Jun 2014 18:31:39 +0900 Subject: Fix behavior of handling BC era dates. BC era year is (astronomical year + 1) and starts from 1 BC. --- .../test/cases/adapters/postgresql/timestamp_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activerecord/test/cases/adapters/postgresql/timestamp_test.rb') diff --git a/activerecord/test/cases/adapters/postgresql/timestamp_test.rb b/activerecord/test/cases/adapters/postgresql/timestamp_test.rb index d4102bf7be..3614b29190 100644 --- a/activerecord/test/cases/adapters/postgresql/timestamp_test.rb +++ b/activerecord/test/cases/adapters/postgresql/timestamp_test.rb @@ -123,6 +123,18 @@ class TimestampTest < ActiveRecord::TestCase assert_equal date, Developer.find_by_name("aaron").updated_at end + def test_bc_timestamp_leap_year + date = Time.utc(-4, 2, 29) + Developer.create!(:name => "taihou", :updated_at => date) + assert_equal date, Developer.find_by_name("taihou").updated_at + end + + def test_bc_timestamp_year_zero + date = Time.utc(0, 4, 7) + Developer.create!(:name => "yahagi", :updated_at => date) + assert_equal date, Developer.find_by_name("yahagi").updated_at + end + private def pg_datetime_precision(table_name, column_name) -- cgit v1.2.3