[Mono-bugs] [Bug 51422][Min] New - System.Convert.ToDateTime() method doesn't throw proper exception for date and months those are out of range

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 26 Nov 2003 10:24:51 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by banirban@novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=51422

--- shadow/51422	2003-11-26 10:24:51.000000000 -0500
+++ shadow/51422.tmp.26411	2003-11-26 10:24:51.000000000 -0500
@@ -0,0 +1,40 @@
+Bug#: 51422
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: All
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: CORLIB
+AssignedTo: banirban@novell.com                            
+ReportedBy: banirban@novell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Convert.ToDateTime() method doesn't throw proper exception for date and months those are out of range
+
+The following two examples should throw System.FormatException instead of 
+System.ArgumentOutOfRangeException.
+
+using System;
+class C {
+
+	public static void Main () {
+                // month is beyond the range
+		Convert.ToDateTime("2000-25-01");
+	}
+}
+
+using System;
+class C {
+
+	public static void Main () {
+                // date is beyond range
+		Convert.ToDateTime("2000-01-51");
+	}
+}
+
+The same holds good for hour, minute, second and millisecond.