Project

General

Profile

ActionsLike0

Bug #634

closed

Time parsing works in 1.8 but not 1.9

Added by tenderlovemaking (Aaron Patterson) about 16 years ago. Updated over 13 years ago.

Status:
Rejected
Assignee:
-
ruby -v:
Backport:
[ruby-core:19294]

Description

=begin
This works in 1.8, but results in "ArgumentError: argument out of range" in 1.9:

require 'time'
Time::parse('06/21/95 04:24:34 PM')
=end

Like0Actions #1

Updated by rogerdpack (Roger Pack) about 16 years ago

=begin
seems that Date is similarly broken on 1.9, working on 1.8

require 'date'
Date::parse('06/21/95')

~ ruby19 test.rb
/Users/rogerpack/dev/ruby_19_installed/lib/ruby/1.9.0/date.rb:1022:in new_by_frags': invalid date (ArgumentError) from /Users/rogerpack/dev/ruby_19_installed/lib/ruby/1.9.0/date.rb:1066:in parse'
from test.rb:2:in `'

=end

Like0Actions #2

Updated by ko1 (Koichi Sasada) about 16 years ago

  • Assignee set to matz (Yukihiro Matsumoto)

=begin

=end

Like0Actions #3

Updated by yugui (Yuki Sonoda) about 16 years ago

  • Target version set to 1.9.1 Release Candidate

=begin

=end

Like0Actions #4

Updated by yugui (Yuki Sonoda) about 16 years ago

  • Due date set to 12/24/2008
  • Assignee deleted (matz (Yukihiro Matsumoto))

=begin

=end

Like0Actions #5

Updated by tadf (tadayoshi funaba) about 16 years ago

=begin
This is an intentional change (r12859).

=end

Like0Actions #6

Updated by yugui (Yuki Sonoda) about 16 years ago

=begin
On 12/21/08 2:13 PM, tadayoshi funaba wrote:

This is an intentional change (r12859).

Can I regard this issue as rejected?

--
Yugui
http://yugui.jp

=end

Like0Actions #7

Updated by tadf (tadayoshi funaba) about 16 years ago

=begin
yes, at least this is not a bug, i think.

=end

Like0Actions #8

Updated by yugui (Yuki Sonoda) about 16 years ago

  • Status changed from Open to Rejected

=begin

=end

Like0Actions #9

Updated by rogerdpack (Roger Pack) about 16 years ago

=begin

This is an intentional change (r12859).

Can I regard this issue as rejected?

Seems somewhat surprising to me that
Date::parse('06/21/95')

doesn't parse, though I suppose that's better than what 1.8.x currently does:
irb(main):004:0> Date.parse("08/21/97").to_s
=> "0097-08-21"

Which is definitely bad :)

Should I file these as feature requests to have them work [and guess century].

Also should I file a feature request to change Time.parse to raise on
failed parse instead of returning Time.now [as you can't currently
determine if a time parsed successfully or not--at least not easily].

Thanks!
-=R

=end

Like0Actions #10

Updated by matz (Yukihiro Matsumoto) about 16 years ago

=begin

In message "Re: [ruby-core:20779] Re: [Bug #634] Time parsing works in 1.8 but not 1.9"
on Mon, 22 Dec 2008 16:36:53 +0900, "Roger Pack" writes:
|
|>> This is an intentional change (r12859).
|>
|> Can I regard this issue as rejected?
|
|Seems somewhat surprising to me that
|Date::parse('06/21/95')
|
|doesn't parse, though I suppose that's better than what 1.8.x currently does:
|irb(main):004:0> Date.parse("08/21/97").to_s
|=> "0097-08-21"
|
|Which is definitely bad :)

"dd/dd/dd" format itself is very culture dependent and ambiguous. It
is yy/mm/dd in Japan (and other countries), mm/dd/yy in USA, dd/mm/yy
in European countries, right? In some cases, you can tell them by
accident, but we should not rely on luck in general cases. I believe
that is the reason parsing this format is disabled in 1.9.

|Also should I file a feature request to change Time.parse to raise on
|failed parse instead of returning Time.now [as you can't currently
|determine if a time parsed successfully or not--at least not easily].

It seems reasonable. You can file a feature request for this issue.

						matz.

=end

Like0Actions #11

Updated by rogerdpack (Roger Pack) over 15 years ago

=begin
should Date.parse("4/30/2009")
parse in 1.9?

Date.parse("4/30/2009")
ArgumentError: invalid date
...

Thanks!
=end

ActionsLike0

Also available in: Atom PDF