Bug #634
closedTime parsing works in 1.8 but not 1.9
Added by tenderlovemaking (Aaron Patterson) about 17 years ago. Updated over 14 years ago.
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) about 17 years ago
          
          
        
        
          
            Actions
          
          #1
          Updated by rogerdpack (Roger Pack) about 17 years ago
          
          
        
        
          
            Actions
          
          #1
        
      
      =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) almost 17 years ago
          
          
        
        
          
            Actions
          
          #2
          Updated by ko1 (Koichi Sasada) almost 17 years ago
          
          
        
        
          
            Actions
          
          #2
        
      
      - Assignee set to matz (Yukihiro Matsumoto)
=begin
=end
        
           Updated by yugui (Yuki Sonoda) almost 17 years ago
          
          
        
        
          
            Actions
          
          #3
          Updated by yugui (Yuki Sonoda) almost 17 years ago
          
          
        
        
          
            Actions
          
          #3
        
      
      - Target version set to 1.9.1 Release Candidate
=begin
=end
        
           Updated by yugui (Yuki Sonoda) almost 17 years ago
          
          
        
        
          
            Actions
          
          #4
          Updated by yugui (Yuki Sonoda) almost 17 years ago
          
          
        
        
          
            Actions
          
          #4
        
      
      - Due date set to 12/24/2008
- Assignee deleted (matz (Yukihiro Matsumoto))
=begin
=end
        
           Updated by tadf (tadayoshi funaba) almost 17 years ago
          
          
        
        
          
            Actions
          
          #5
          Updated by tadf (tadayoshi funaba) almost 17 years ago
          
          
        
        
          
            Actions
          
          #5
        
      
      =begin
This is an intentional change (r12859).
=end
        
           Updated by yugui (Yuki Sonoda) almost 17 years ago
          
          
        
        
          
            Actions
          
          #6
          Updated by yugui (Yuki Sonoda) almost 17 years ago
          
          
        
        
          
            Actions
          
          #6
        
      
      =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) almost 17 years ago
          
          
        
        
          
            Actions
          
          #7
          Updated by tadf (tadayoshi funaba) almost 17 years ago
          
          
        
        
          
            Actions
          
          #7
        
      
      =begin
yes, at least this is not a bug, i think.
=end
        
           Updated by yugui (Yuki Sonoda) almost 17 years ago
          
          
        
        
          
            Actions
          
          #8
          Updated by yugui (Yuki Sonoda) almost 17 years ago
          
          
        
        
          
            Actions
          
          #8
        
      
      - Status changed from Open to Rejected
=begin
=end
        
           Updated by rogerdpack (Roger Pack) almost 17 years ago
          
          
        
        
          
            Actions
          
          #9
          Updated by rogerdpack (Roger Pack) almost 17 years ago
          
          
        
        
          
            Actions
          
          #9
        
      
      =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) almost 17 years ago
          
          
        
        
          
            Actions
          
          #10
          Updated by matz (Yukihiro Matsumoto) almost 17 years ago
          
          
        
        
          
            Actions
          
          #10
        
      
      =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 16 years ago
          
          
        
        
          
            Actions
          
          #11
          Updated by rogerdpack (Roger Pack) over 16 years ago
          
          
        
        
          
            Actions
          
          #11
        
      
      =begin
should Date.parse("4/30/2009")
parse in 1.9?
Date.parse("4/30/2009")
ArgumentError: invalid date
...
Thanks!
=end