Even if you manage to store this date period on your database, Ruby
can't handle it afaik.

So I'd suggest handling dates on your application level (ie store
years/months on different int fields and handle storing/loading with
custom classes).

On Wed, Feb 3, 2010 at 5:32 PM, Matt Mazur <[email protected]> wrote:
> Hi,
>
> I'm in the process of deploying my app on Heroku and have run into a
> problem with the way PostgreSQL handles B.C. dates.
>
> My local MySQL database contains a events table that has a start_at
> column which is a datetime. I can use negative years without any
> issues. For example, my code is something like
>
> e = Event.new(:start_at => DateTime.new(-5000))
>
> Here's a snippet of the log file when I save it locally:
>
> INSERT INTO "events" (... "start_at" ... ) VALUES(... '-5000-01-01
> 00:00:00'...)
>
> However with PostgreSQL it will fail:
>
> ActiveRecord::StatementInvalid (PGError: ERROR:  time zone
> displacement out of range: "-5000-01-01 00:00:00.000000"
> : INSERT INTO "events" (... "start_at", ...) VALUES(... E'',
> '-5000-01-01 00:00:00.000000' ...) RETURNING "id"):
>
> I assume this problem is caused by the negative year even though it
> says it's the time zone because positive years work fine. Any ideas?
>
> Appreciate the help,
> Matt
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Heroku" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/heroku?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to