Bug #634
closedTime parsing works in 1.8 but not 1.9
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
Updated by rogerdpack (Roger Pack) almost 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
Updated by ko1 (Koichi Sasada) over 15 years ago
- Assignee set to matz (Yukihiro Matsumoto)
=begin
=end
Updated by yugui (Yuki Sonoda) over 15 years ago
- Target version set to 1.9.1 Release Candidate
=begin
=end
Updated by yugui (Yuki Sonoda) over 15 years ago
- Due date set to 12/24/2008
- Assignee deleted (
matz (Yukihiro Matsumoto))
=begin
=end
Updated by tadf (tadayoshi funaba) over 15 years ago
=begin
This is an intentional change (r12859).
=end
Updated by yugui (Yuki Sonoda) over 15 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 yugui@yugui.jp
http://yugui.jp
=end
Updated by tadf (tadayoshi funaba) over 15 years ago
=begin
yes, at least this is not a bug, i think.
=end
Updated by rogerdpack (Roger Pack) over 15 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
Updated by matz (Yukihiro Matsumoto) over 15 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" rogerpack2005@gmail.com 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
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