[Mono-bugs] [Bug 376929] New: DateTime.ParseExact adds day when parsing minvalue

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Apr 3 15:46:53 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=376929


           Summary: DateTime.ParseExact adds day when parsing minvalue
           Product: Mono: Class Libraries
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: gert.driesen at pandora.be
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


When parsing an ISO 8601 date string representing DateTime.MinValue using
DateTime.ParseExact, an extra days is added to the resulting DateTime instance;
meaning you'll get 01/02/0001, instead of 01/01/0001.

To reproduce, compile and run the following code snippet using (g)mcs:

using System;
using System.Globalization;
using System.Xml;

class Program
{
        static void Main ()
        {
                const string format = "yyyy-MM-ddTHH:mm:ss.fffffffzzz";

                string d = DateTime.MinValue.ToString (format,
                        CultureInfo.InvariantCulture);
                DateTime date = DateTime.ParseExact (d, format,
                        CultureInfo.InvariantCulture);
                Console.WriteLine (date == DateTime.MinValue);
        }
}

Expected result:

True

Actual result:

False


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list