When Rails3 serializes ActiveSupport::TimeWithZone to json that dates look something like this:
“2011-07-20T23:59:00-07:00”
… it should be …
“2011-07-20T23:59:00-0700”
That last colon is problematic when trying to convert that string using standard date formatting patterns … none of them account for the use of a colon!
So my question is, “How do I override/change the serialization for TimeWithZone so that as_json returns a valid string that can be understood using the standard date format patterns?”
Right now I have to strip that last colon out in my client app but that just seems pooch.
It is a monkey patch, but hey it is Ruby and that is allowed.
Tested by running: