From: Vadim Zeitlin Date: Mon, 22 Mar 2010 22:56:17 +0000 (+0000) Subject: Clarify wxDateTime::ParseDateTime() semantics: it needs both date and time. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7633bfcd68d2292c21bdcb41aac952a49a4c07f0 Clarify wxDateTime::ParseDateTime() semantics: it needs both date and time. Correct documentation and also remove unnecessary initialization of variables and comments in the function itself. See #11846. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/interface/wx/datetime.h b/interface/wx/datetime.h index e8eb26d46d..9e11fed428 100644 --- a/interface/wx/datetime.h +++ b/interface/wx/datetime.h @@ -59,7 +59,7 @@ in 'free' format, i.e. allow them to be specified in any of possible ways. These functions will usually be used to parse the (interactive) user input which is not bound to be in any predefined format. As an example, - ParseDateTime() can parse the strings such as "tomorrow", "March first" and + ParseDate() can parse the strings such as "tomorrow", "March first" and even "next Sunday". Finally notice that each of the parsing functions is available in several @@ -821,7 +821,9 @@ public: This function tries as hard as it can to interpret the given string as date and time. Unlike ParseRfc822Date(), it will accept anything that may be accepted and will only reject strings which can not be parsed in - any way at all. + any way at all. Notice that the function will fail if either date or + time part is present but not both, use ParseDate() or ParseTime() to + parse strings containing just the date or time component. See ParseFormat() for the description of function parameters and return value. diff --git a/src/common/datetimefmt.cpp b/src/common/datetimefmt.cpp index f9404d8642..bf92016525 100644 --- a/src/common/datetimefmt.cpp +++ b/src/common/datetimefmt.cpp @@ -1497,10 +1497,9 @@ wxDateTime::ParseDateTime(const wxString& date, wxString::const_iterator *end) { wxCHECK_MSG( end, false, "end iterator pointer must be specified" ); - // Set to current day and hour, so strings like '14:00' becomes today at - // 14, not some other random date - wxDateTime dtDate = wxDateTime::Today(); - wxDateTime dtTime = wxDateTime::Today(); + wxDateTime + dtDate, + dtTime; wxString::const_iterator endTime,