mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 13:23:07 +02: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;
|
gint step, i;
|
||||||
const guint16 *max_days;
|
const guint16 *max_days;
|
||||||
|
|
||||||
|
__year += years;
|
||||||
|
|
||||||
/* subtract one day for leap years */
|
/* subtract one day for leap years */
|
||||||
if (GREGORIAN_LEAP (__year) && __month == 2)
|
if (GREGORIAN_LEAP (__year) && __month == 2)
|
||||||
{
|
{
|
||||||
@ -364,8 +366,6 @@ g_date_time_add_dmy (GDateTime *datetime,
|
|||||||
__day -= 1;
|
__day -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
__year += years;
|
|
||||||
|
|
||||||
/* add months */
|
/* add months */
|
||||||
step = months > 0 ? 1 : -1;
|
step = months > 0 ? 1 : -1;
|
||||||
for (i = 0; i < ABS (months); i++)
|
for (i = 0; i < ABS (months); i++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user