gdatetime: Fix locale-changing code