Fix regression in custom date fields

When localized date formatting was implemented, saving of those dates in the database was broken. This fix correctly handles custom date fields to/from the database.