Bug 17626 - "12-002" is not recognized as a valid Date
Summary: "12-002" is not recognized as a valid Date
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: 3.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2014-02-05 18:23 UTC by Gustavo Guerra
Modified: 2015-02-04 09:37 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Gustavo Guerra 2014-02-05 18:23:58 UTC
This was caught on the FSharp.Data unit tests running on Travis with http://download.xamarin.com/MonoFrameworkMDK/Macx86/MonoFramework-MDK-3.2.5.macos10.xamarin.x86.pkg

.NET considers it as day 01, month 12, year 0002
Comment 1 Miguel de Icaza [MSFT] 2014-02-11 17:47:26 UTC
Can you share the bit of code that hit this issue, before we embark in looking for every place that might handle a date?
Comment 2 Gustavo Guerra 2014-02-11 17:51:10 UTC
DateTime.TryParse("12-002", CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.RoundtripKind) reproduces the bug (but I assume DateTime.Parse will also have the problem).

Found here: 
Comment 3 Marek Safar 2014-02-14 11:08:06 UTC
This is tricky case to handle with current implementation. 

DateTime.Parse ("00002-12", CultureInfo.InvariantCulture);

This should work as well but it does not because we do try all possible formats instead of actual parsing and 00002 will never match to any of predefined formats.
Comment 4 Marek Safar 2015-02-04 09:37:13 UTC
Fixed in master