diff --git a/src/gcal-date-selector.c b/src/gcal-date-selector.c index a2c2c94c..25d8a32a 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;