]> git.saurik.com Git - wxWidgets.git/commitdiff
Clarify wxDateTime::ParseDateTime() semantics: it needs both date and time.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Mar 2010 22:56:17 +0000 (22:56 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Mar 2010 22:56:17 +0000 (22:56 +0000)
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

interface/wx/datetime.h
src/common/datetimefmt.cpp

index e8eb26d46d23bc69ea7180e9acb117143b36ec30..9e11fed428b47fd21fb620905e2b359d07ab72af 100644 (file)
@@ -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.
index f9404d864292692cc3fff9b1486545be18cfab5e..bf920165252fc7c7bf71a74fd65a8664864c4288 100644 (file)
@@ -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,