-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inconsistency with Time serialization #29
Comments
hmmm - need to check. But there is are many of datetime like objects in the ruby/rails eco system. Also I wonder whether Date or DateTime is consistent in and out of an array. |
JrJackson::Json.dump(Time.now.to_date)
=> "2014-06-11" JrJackson::Json.dump([Time.now.to_date])
=> "[\"2014-06-11 00:00:00 EDT\"]" JrJackson::Json.dump(Time.now.to_datetime)
=> "2014-06-11T09:12:16-04:00" JrJackson::Json.dump([Time.now.to_datetime])
=> "[\"2014-06-11 09:12:22 EDT\"]" also, as noted, JRuby coerces irb(main):033:0> Time.now.to_java
=> #<Java::JavaUtil::Date:0x1042db3e> but Time.now.to_datetime.to_java
=> #<DateTime:0x2012e4d @dt=#<Java::OrgJodaTime::DateTime:0x1b86c242>, @sub_millis=0, @of=(-1/6), @sg=2299161>
Time.now.to_date.to_java
=> #<Date:0x2e80f606 @dt=#<Java::OrgJodaTime::DateTime:0x14981bc4>, @sub_millis=0, @of=0, @sg=#<Date::Infinity:0x520a06c6 @d=-1>> So it looks like |
Any update on this issue? Please also have a look on my comments in this issue #12 Its not just a "format" issue, but serialisation of UTC time works wrong |
I have added some comments to #12 and copied them to a new wiki page. Ruby Time serialisation. @PetrKaleta, I believe that the additions by @colinsurprenant implemented in release 0.2.8 fixes this. Closing. |
Time object will be handled by
to_s
at https://github.com/guyboertje/jrjackson/blob/master/lib/jrjackson/jrjackson.rb#L45Time object will be handled by Jackson as a
Java::JavaUtil::Date
Time object will be handled by Jackson as a
Java::JavaUtil::Date
Wouldn't it be better to also add
Time
as a shortcut toJrJackson::Raw.generate
at https://github.com/guyboertje/jrjackson/blob/master/lib/jrjackson/jrjackson.rb#L36 ?The text was updated successfully, but these errors were encountered: