Merge pull request #1099 from jsportaro/master
authorMarek Safar <marek.safar@gmail.com>
Mon, 16 Jun 2014 10:52:45 +0000 (12:52 +0200)
committerMarek Safar <marek.safar@gmail.com>
Mon, 16 Jun 2014 10:52:45 +0000 (12:52 +0200)
Added fix for Bug 11630

mcs/class/corlib/System/DateTime.cs
mcs/class/corlib/Test/System/DateTimeTest.cs

index c3da055efc02589a97da57a0fc3d9f8d0ca52e81..30bc6f8edf82b05deb1da4e8a2ebc8a2cacd389c 100644 (file)
@@ -214,6 +214,10 @@ namespace System
                        "yyyy/MMMM",
                };
 
+               private static readonly string[] ExoticAndNonStandardFormats = new string[] {
+                       "ddMMMyyyy"
+               };
+
                private enum Which 
                {
                        Day,
@@ -927,6 +931,9 @@ namespace System
                        if (ParseExact (s, dfi.GetAllDateTimePatternsInternal (), dfi, styles, out result, false, ref longYear, setExceptionOnError, ref exception))
                                return true;
 
+                       if (ParseExact (s, ExoticAndNonStandardFormats, dfi, styles, out result, false, ref longYear, setExceptionOnError, ref exception))
+                               return true;
+
                        if (!setExceptionOnError)
                                return false;
                        
index 0e7b294f3b9495c29fef8db2a6b71faf1be62475..343e723be82e8b6ce8bf0145a4e4a57c93a78482 100644 (file)
@@ -1216,6 +1216,15 @@ namespace MonoTests.System
                        DateTime.Parse ("Sat,,, 01,,, Oct,,, ,,,1994 03:00:00", CultureInfo.InvariantCulture);
                }
 
+               [Test]
+               public void TryParse_Bug11630 ()
+               {
+                       DateTime parsed;
+
+                       Assert.IsTrue (DateTime.TryParse ("10Feb2013", out parsed));
+                       Assert.AreEqual (new DateTime (2013, 2, 10), parsed);
+               }
+
                [Test]
                [ExpectedException (typeof (FormatException))]
                public void Parse_CommaAfterHours ()