From: noreply@... Date: 2007-04-13T19:06:14+09:00 Subject: [ ruby-Bugs-10083 ] Inconsistencies between Time and Date classes Bugs item #10083, was opened at 2007-04-13 12:06 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=10083&group_id=426 Category: Standard Library Group: None Status: Open Resolution: None Priority: 3 Submitted By: Jan Faber (fjan) Assigned to: Nobody (None) Summary: Inconsistencies between Time and Date classes Initial Comment: The Time and Date class treat edge cases differently. This is prone to introduce errors since they are often used together. Example 1: 24:00 is valid in DateTime but not in Time puts DateTime::valid_time?(24,0,0) # => 1 (valid) puts Time.utc(2007,1,1,24,0) # => Argument error: argument out of range Example 2: 31st of april wraps around in Time but is an error in Date puts Time.parse("4/31/2007") # => Tue May 1 00:00:00 2007 puts DateTime.parse("4/31/2007") # => Argument error: invalid date Especially the first one is annoying because you need to check for "hour==24" everywhere you parse a human entered string into a since otherwise it will parse and validate fine but then error out when you try to make a time out of it. (Try out entering 24:00 as a time in a random RoR application and see it crash :-/) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=10083&group_id=426