]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/date.h
Removed unnecessary code from utilsunx.cpp
[wxWidgets.git] / include / wx / date.h
index d4dd19c745d2064c4cbe855e3b561a5b55ec36f6..11ff72017f7e8e60ccc6261958bf39c96aa60eda 100644 (file)
@@ -81,8 +81,8 @@ public:
     long operator-(const wxDate &dt) const
         { return GetJulianDate() - dt.GetJulianDate(); }
 
-    wxDate &operator+=(long i) { m_date += wxTimeSpan::Days(i); return *this; }
-    wxDate &operator-=(long i) { m_date -= wxTimeSpan::Days(i); return *this; }
+    wxDate &operator+=(long i) { m_date += wxTimeSpan::Days((int)i); return *this; }
+    wxDate &operator-=(long i) { m_date -= wxTimeSpan::Days((int)i); return *this; }
 
     wxDate &operator++() { return *this += 1; }
     wxDate &operator++(int) { return *this += 1; }
@@ -179,11 +179,11 @@ public:
 
     wxDate Previous(int dayOfWeek) const
     {
+        wxDate prev = *this;
         int dow = GetDayOfWeek();
-        if ( dayOfWeek <= dow )
-            return *this - (dow - dayOfWeek);
-        else
-            return *this - 7 + (dayOfWeek - dow);
+        prev -= dayOfWeek > dow ? 7 - (dayOfWeek - dow) : dow - dayOfWeek;
+
+        return prev;
     }
 
     wxString FormatDate(int type = -1) const