mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
datetime: Fix a thinko
We need to check if a year is a leap one *after* we increased it with the given value, not before.
This commit is contained in:
parent
026375b395
commit
08877ee0dc
@ -357,6 +357,8 @@ g_date_time_add_dmy (GDateTime *datetime,
|
||||
gint step, i;
|
||||
const guint16 *max_days;
|
||||
|
||||
__year += years;
|
||||
|
||||
/* subtract one day for leap years */
|
||||
if (GREGORIAN_LEAP (__year) && __month == 2)
|
||||
{
|
||||
@ -364,8 +366,6 @@ g_date_time_add_dmy (GDateTime *datetime,
|
||||
__day -= 1;
|
||||
}
|
||||
|
||||
__year += years;
|
||||
|
||||
/* add months */
|
||||
step = months > 0 ? 1 : -1;
|
||||
for (i = 0; i < ABS (months); i++)
|
||||
|
Loading…
Reference in New Issue
Block a user