Project

General

Profile

Actions

Bug #14790

closed

DateTime.iso8601 parses incorrect ISO8601

Added by Quintasan (Michał Zając) almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
2.4.2p198
[ruby-core:87276]

Description

I noticed it today when migrating to Time in my library but DateTime somehow parses incorrect ISO8601 dates. Technically that's a feature but I believe this behaviour is incorrect. Time#iso8601 behaves correctly in this case.

Steps to reproduce

require 'time'
date = "2018-05-17T12:17:11+0200"
DateTime.iso8601(date) # => #<DateTime: 2018-05-17T12:17:11+02:00 ((2458256j,37031s,0n),+7200s,2299161j)>
Time.iso8601(date) # ArgumentError: invalid date: "2018-05-17T12:17:11+0200"
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0