[gnome-calendar/date-selector] date-selector: clamp day & month values before validating it



commit 80825ec051ab973dbfc1849adaabc12bf610b514
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Dec 21 13:03:20 2014 -0200

    date-selector: clamp day & month values before validating it

 src/gcal-date-selector.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/gcal-date-selector.c b/src/gcal-date-selector.c
index a2c2c94..25d8a32 100644
--- a/src/gcal-date-selector.c
+++ b/src/gcal-date-selector.c
@@ -342,6 +342,8 @@ gcal_date_selector_set_date (GcalDateSelector *selector,
 
   g_return_if_fail (GCAL_IS_DATE_SELECTOR (selector));
   priv = gcal_date_selector_get_instance_private (selector);
+  day = CLAMP (day, 1, 31);
+  month = CLAMP (month, 1, 12);
   /* since we're dealing only with the date, the tz shouldn't be a problem */
   dt = g_date_time_new_local (year, month, day, 0, 0, 0);
 
@@ -353,9 +355,6 @@ gcal_date_selector_set_date (GcalDateSelector *selector,
   if (dt == NULL)
     return;
 
-  day = CLAMP (day, 1, 31);
-  month = CLAMP (month, 1, 12);
-
   priv->day = day;
   priv->month = month;
   priv->year = year;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]