[Mono-bugs] [Bug 51422][Min] Changed - 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
Sat, 29 Nov 2003 07:34:02 -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.22656	2003-11-29 07:34:02.000000000 -0500
@@ -1,14 +1,14 @@
 Bug#: 51422
 Product: Mono/Class Libraries
 Version: unspecified
 OS: Red Hat 9.0
 OS Details: All
-Status: NEW   
-Resolution: 
-Severity: 
+Status: RESOLVED   
+Resolution: FIXED
+Severity: Unknown
 Priority: Minor
 Component: CORLIB
 AssignedTo: banirban@novell.com                            
 ReportedBy: banirban@novell.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -35,6 +35,45 @@
                 // date is beyond range
 		Convert.ToDateTime("2000-01-51");
 	}
 }
 
 The same holds good for hour, minute, second and millisecond.
+
+------- Additional Comments From banirban@novell.com  2003-11-29 07:34 -------
+Follows the fix :
+
+@@ -929,8 +934,18 @@
+ 			}
+
+ 
+
+ 			if (ampm == 1)
+
+-				hour = hour + 12;
+
+-
+
++				hour = hour + 12;
++
++			// this is added to make the 
++			// code compatible to .Net 1.1
++			if ( year < 1 || year > 9999 || 
+
++			month < 1 || month >12  ||
+
++			day < 1 || day > DaysInMonth(year, month) ||
+
++			hour < 0 || hour > 23 ||
+
++			minute < 0 || minute > 59 ||
+
++			second < 0 || second > 59 )
++				return false;
+
++
+ 			result = new DateTime (year, month, day, hour, minute, second,
+millisecond);
+
+ 
+
+ 			if ((dayofweek != -1) && (dayofweek != (int) result.DayOfWeek))