Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/date/date_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -8485,7 +8485,7 @@ datetime_s_iso8601(int argc, VALUE *argv, VALUE klass)
VALUE argv2[2], hash;
argv2[0] = str;
argv2[1] = opt;
if (!NIL_P(opt)) argc2--;
if (!NIL_P(opt)) argc2++;
hash = date_s__iso8601(argc2, argv2, klass);
return dt_new_by_frags(klass, hash, sg);
}
Expand Down
8 changes: 8 additions & 0 deletions test/date/test_date_strftime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,14 @@ def test__different_format
assert_equal('H31.04.30', Date.parse('2019-04-30').jisx0301)
assert_equal('R01.05.01', Date.parse('2019-05-01').jisx0301)

assert_equal(d2, DateTime.iso8601('2001-02-03T04:05:06.123456+00:00', limit: 64))
assert_equal(d2, DateTime.rfc3339('2001-02-03T04:05:06.123456+00:00', limit: 64))
assert_equal(d2, DateTime.jisx0301('H13.02.03T04:05:06.123456+00:00', limit: 64))

assert_raise(ArgumentError) { DateTime.iso8601('2001-02-03T04:05:06.123456+00:00', limit: 1) }
assert_raise(ArgumentError) { DateTime.rfc3339('2001-02-03T04:05:06.123456+00:00', limit: 1) }
assert_raise(ArgumentError) { DateTime.jisx0301('H13.02.03T04:05:06.123456+00:00', limit: 1) }

%w(M06.01.01
M45.07.29
T01.07.30
Expand Down