Project

General

Profile

Actions

Bug #12285

closed

Date.iso8601 does not properly handle partial date strings

Added by backus (John Backus) almost 8 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
[ruby-core:74956]

Description

For reduced accuracy, any number of values may be dropped from any of the date and time representations, but in the order from the least to the most significant. For example, "2004-05" is a valid ISO 8601 date, which indicates May (the fifth month) 2004.

From https://en.wikipedia.org/wiki/ISO_8601#cite_ref-AccuracyVsPrecision_8-0

However if I parse this example value with Date.iso8601 I get "January 5th, 2004" when I expect "May 1st, 2004":

$ irb -r date
2.3.0 :001 > date = Date.iso8601('2004-05')
 => #<Date: 2004-01-05 ((2453010j,0s,0n),+0s,2299161j)>
2.3.0 :002 > date.month
 => 1

Files

iso8601_YYYY_MM.patch (1.39 KB) iso8601_YYYY_MM.patch jonwolski (Jon Wolski), 12/11/2017 09:59 PM

Related issues 2 (0 open2 closed)

Has duplicate Ruby master - Bug #12833: incorrect iso8601 parsing of YYYY-MM formatClosedActions
Has duplicate Ruby master - Bug #12981: Date.parse raises an Argument error under a specific conditionClosedActions

Updated by backus (John Backus) over 7 years ago

Could anyone tell me who to talk to find out if this issue is a WONTFIX? I have only reported a few things on this bug tracker so far so I'm not sure who to ping on an issue if it seems to be overlooked.

Updated by hsbt (Hiroshi SHIBATA) over 7 years ago

Date is not maintained now. We can not answer your concern.

Updated by zverok (Victor Shepelev) over 7 years ago

Date is not maintained now. We can not answer your concern.

What does this mean? Date is in a separated gem now, or just not all of the standard library has its maintainers?
This is also related to DateTime, as far as I can understand?

Updated by backus (John Backus) over 7 years ago

Victor Shepelev wrote:

Date is not maintained now. We can not answer your concern.

What does this mean? Date is in a separated gem now, or just not all of the standard library has its maintainers?
This is also related to DateTime, as far as I can understand?

I'm interested in the answer for this too. What exactly does "Date is not maintained" mean? Is there something in the documentation that conveys this? What else is not maintained in the standard library?

Updated by duerst (Martin Dürst) over 7 years ago

There is some information about library maintainers e.g. at
https://bugs.ruby-lang.org/projects/ruby/wiki/MaintainersStdlib or
https://bugs.ruby-lang.org/projects/ruby/wiki/Contributors,
but these may not be up to date.

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Status changed from Open to Assigned
  • Assignee set to tadf (tadayoshi funaba)

As I read the code, Date.iso8601 allows to omit a month by '-', but not a day.
It feels like a bug to me, but uncertain.

Updated by hsbt (Hiroshi SHIBATA) over 7 years ago

all of the standard library has its maintainers?

Yes. See https://github.com/ruby/ruby/blob/trunk/doc/maintainers.rdoc

Actions #8

Updated by shyouhei (Shyouhei Urabe) over 7 years ago

  • Has duplicate Bug #12833: incorrect iso8601 parsing of YYYY-MM format added

Updated by jonwolski (Jon Wolski) over 6 years ago

I had submitted a patch to an issue that got marked as a 'duplicate' (though it is still "open"). My ticket is not "assigned," so maybe it would help to add the patch here as well. Also, the corresponding pull-request on GitHub is https://github.com/ruby/ruby/pull/1463

Actions #10

Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago

  • Has duplicate Bug #12981: Date.parse raises an Argument error under a specific condition added

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

  • Status changed from Assigned to Open
  • Assignee deleted (tadf (tadayoshi funaba))
Actions #12

Updated by nobu (Nobuyoshi Nakada) over 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|75fb0a9afad1685cedee9c7665a7f30ec95068fc.


Allow mday in Date.iso8601 to be omitted

[Bug #12285]

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0