Project

General

Profile

This project is closed and read-only.

Actions

Bug #281

closed

Time.parse does not throw ArgumentError on all invalid arguments

Bug #281: Time.parse does not throw ArgumentError on all invalid arguments

Added by Anonymous about 18 years ago. Updated over 15 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
[ruby-core:17810]

Description

=begin
When Time.parse is not able to parse certain strings into valid Time objects, it does not throw ArgumentErrors. Instead, it returns Time.now.

For example, Time.parse("asdf") returns Wed Jul 16 17:03:19 -0400 2008.

This is observed on Mac OS X 10.5.3 running on a power pc and on Ubuntu 8.04 running ruby 1.8.6.
=end

Updated by shyouhei (Shyouhei Urabe) about 18 years ago Actions #1

  • Status changed from Open to Rejected

=begin
Yes. That's an expected behavior.
Time.parse ignores what cannot be a time representation (ex.
Time.parse("it's 18:00") #=> Time object of 18:00 today), and
Time.parse("") is designed to be Time.now, hence the result.
=end

Actions

Also available in: PDF Atom