5.05.2017 12:32 Andrea Zagli via gtk-list <[hidden email]> wrote:
> is it normal that if i pass values out of range to function
> g_date_time_new_local it returns a valida date?
> glib 2.50.3 debian sid
> try this code: it returns 2017-03-02, instead i expected NULL
The documentation of g_date_time_new_local says: 
"This call is equivalent to calling g_date_time_new()…" 
while g_date_time_new says:
"day [must be] between 1 and 28, 29, 30 or 31 depending on the
month and the year."
"It not considered a programmer error for the values to this function
to be out of range, but in the case that they are, the function will
* day must be in a valid range for the given month, the documentation
does not say it must be <=31, neither it says it may be any number
and it will be recalculated into a valid day of another month,
* it is not an error if the value is out of range (and 30 of February
is out of range) so the program will not crash and will not display
a critical error message but it clearly says the function will
* also the documentation mentions the dates which are not representable
or ambiguous due to the DST changes but 30 of February is not
unrepresentable, it's just out of range.
Having read this it seems to me to be a bug. Either the code must
be fixed to reflect the documentation or the documentation must be
changed to reflect the code.
Of course my opinion is not authoritative so the proper authors
are welcome to answer.