Protect GDateTime from getting an out-of-range year at creation.

It can behave badly. See
https://bugzilla.gnome.org/show_bug.cgi?id=721791#c8

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

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