rails/rails — pull request #15521 by edogawaconan (2014-06-05 09:54:52+00:00)
Title: Fix BC year handling in postgres

Current method is broken: it simply converts astronomical year (what ruby uses) to BC era year (what postgres uses) even though they're off by one, starts from 1, and year 0 AD does not exist which causes postgres to return error.

- `0000-01-01` => `0001-01-01 BC`
- `0000-02-29` => `0001-02-29 BC`

For example, just try searching any model's `created_at` with `Date.new(0)` (0001-01-01 BC) or `Date.new(-4,2,29)` (0005-02-29 BC).