DateTime Parse and TryParse Issues - CultureInfo

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
Posts: 2
Joined: Thu Feb 18, 2016 6:15 am

DateTime Parse and TryParse Issues - CultureInfo

Postby cz_1 » Thu Feb 18, 2016 7:57 am


It seems that browsers have a problem with the CultureInfo class when parsing DateTimes. Tested on IE and Chrome (Error messages are from Chrome):

Code: Select all

DateTime dt;
dt = DateTime.Parse(dtStr, CultureInfo.InvariantCulture);

--> TypeError: Cannot read property 'MemberwiseClone' of undefined

Code: Select all

DateTime.TryParse(dtStr, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt);

--> Error: Memoized value is undefined.

No exception is thrown if using CultureInfo at the ToString() method, but the returned string-value is "undefined":

Code: Select all

var dtToString = dt.ToString(CultureInfo.InvariantCulture);

--> results in a string "undefined"

These bugs are not that critical but annoying - because in the debugger, all is working fine.. and for multi-language support, using the CultureInfo class would be nice..

Best Regards,

JS-Support @Userware
Site Admin
Posts: 966
Joined: Tue Apr 08, 2014 3:42 pm

Re: DateTime Parse and TryParse Issues - CultureInfo

Postby JS-Support @Userware » Mon Feb 22, 2016 5:30 am

Thanks. We have indeed reported issues related to the CultureInfo class. We plan a complete rewrite of the DateTime class in Mid-2016. Let us keep in touch. Thanks again.

Posts: 1
Joined: Sun Apr 17, 2016 10:31 pm

Re: DateTime Parse and TryParse Issues - CultureInfo

Postby clintwelbar » Tue Dec 13, 2016 11:13 pm

public static bool TryParse(
string s,
out DateTime result

This method is similar to the DateTime.Parse(String) method, except that the TryParse(String, DateTime) method does not throw an exception if the conversion fails. Also, this method tries to ignore unrecognized data, if possible, and fills in missing month, day, and year information with the current date. The TryParse method is culture dependent so be very careful if you decide use it. More conversion


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 2 guests