Project

General

Profile

Actions

Bug #10587

closed

Time#to_json != DateTime#to_json (Time#to_json not outputting iso8601)

Added by bhaak (Patric Mueller) over 9 years ago. Updated almost 9 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
[ruby-core:66779]

Description

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.

Updated by naruse (Yui NARUSE) almost 9 years ago

  • Status changed from Open to Third Party's Issue

Could you report to upstream?
https://github.com/flori/json

Actions

Also available in: Atom PDF

Like0
Like0