Fix memory leaks due to localtime -> gnc_localtime replacement in r22618, r22626, r22627

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22829 57a11ea4-9604-0410-9ed3-97b8803252fd
Fix erroneous conversion from time64 to struct tm because the Sunday weekday has a different number in GDateTime vs. struct tm.

In struct tm, the weekday is in the range 0..6 with Sunday=0, but
in GDateTime the weekday is in the range 1..7 with Sunday=7. This should
better be added to the GDateTime documentation at g_date_time_get_day_of_week,
but apparently nobody documented this so far.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22830 57a11ea4-9604-0410-9ed3-97b8803252fd