Forum: Ruby on Rails DateTime problem in AWS

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Josh (Guest)
on 2006-04-26 00:35
I am trying to implement a web service that returns a datetime stamp as
part of the structured object returned in the response.  As noted in
another post (http://www.ruby-forum.com/topic/59762), there seems to be
a problem with the DateTime.parse method in that it does not match the
year.  Is anyone aware of workaround for this issue?

My current idea (a hack, but it seems to work) is to modify the
AWS/casting.rb module so that casting of datetime stamp is done by the
Time class instead of DateTime.  Essentially, I have changed line 106 to
read "Time.parse(value.to_s)."  This is not a best practice for sure, so
I am eagerly in search of another solution.

Thanks.

Josh
Kent S. (Guest)
on 2006-04-26 21:43
(Received via mailing list)
You can use :time data type for your timestamps instead of modifying
casting.rb.
This topic is locked and can not be replied to.