[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:45:07 -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-29 07:34:02.000000000 -0500
+++ shadow/51422.tmp.22773 2003-11-29 07:45:06.000000000 -0500
@@ -1,13 +1,13 @@
Bug#: 51422
Product: Mono/Class Libraries
Version: unspecified
OS: Red Hat 9.0
OS Details: All
Status: RESOLVED
-Resolution: FIXED
+Resolution:
Severity: Unknown
Priority: Minor
Component: CORLIB
AssignedTo: banirban@novell.com
ReportedBy: banirban@novell.com
QAContact: mono-bugs@ximian.com
@@ -74,6 +74,47 @@
result = new DateTime (year, month, day, hour, minute, second,
millisecond);
if ((dayofweek != -1) && (dayofweek != (int) result.DayOfWeek))
+
+------- Additional Comments From banirban@novell.com 2003-11-29 07:45 -------
+RCS file: /mono/mcs/class/corlib/System/DateTime.cs,v
+retrieving revision 1.40
+diff -u -r1.40 DateTime.cs
+
+@@ -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))