Skip to content
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

iso8601 dates break on 0.4.0 #68

Closed
paulsc opened this issue Dec 10, 2014 · 1 comment
Closed

iso8601 dates break on 0.4.0 #68

paulsc opened this issue Dec 10, 2014 · 1 comment

Comments

@paulsc
Copy link

paulsc commented Dec 10, 2014

Hi,

After upgrading to 0.4.0, my dates are formated in json as "2014-12-10 17:04:01 UTC" instead of "2014-12-10T17:04:01.678Z" (iso8601) like it is on 0.3.4.

It seems an object of type JSON::Ext::Generator::State is being passed to to_json which makes the date be outputted in that format.

Any idea how to fix ?

Thanks

@paulsc paulsc changed the title iso8601 breaks on 0.4.0 iso8601 dates break on 0.4.0 Dec 10, 2014
@ccocchi
Copy link
Owner

ccocchi commented Dec 27, 2014

What JSON engine are you using? By default, rabl-rails uses Oj with default options that can be found here https://github.com/ccocchi/rabl-rails/blob/master/lib/rabl-rails.rb#L22.

If you want another date format, you can change these Oj default options in a initializer. Oj options can be found here http://www.rubydoc.info/gems/oj/Oj#default_options-class_method

@ccocchi ccocchi closed this as completed Jul 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants