From: naruse@... Date: 2015-07-28T12:10:25+00:00 Subject: [ruby-core:70154] [Ruby trunk - Bug #10587] [Third Party's Issue] Time#to_json != DateTime#to_json (Time#to_json not outputting iso8601) Issue #10587 has been updated by Yui NARUSE. Status changed from Open to Third Party's Issue Could you report to upstream? https://github.com/flori/json ---------------------------------------- Bug #10587: Time#to_json != DateTime#to_json (Time#to_json not outputting iso8601) https://bugs.ruby-lang.org/issues/10587#change-53581 * Author: Patric Mueller * Status: Third Party's Issue * Priority: Normal * Assignee: * ruby -v: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- The output of this program is false: ``` require 'date' require 'json' now = Time.now puts now.to_json == DateTime.parse(now.to_s).to_json ``` Testing in IRB shows why: ``` 2.1.5 :004 > now.to_json => "\"2014-12-11 10:34:53 +0100\"" 2.1.5 :005 > DateTime.parse(now.to_s).to_json => "\"2014-12-11T10:34:53+01:00\"" ``` Time#to_json doesn't return an iso8601 conforming string whereas DateTime@to_json does. -- https://bugs.ruby-lang.org/