Fixes for using date as primary key. ISO 8601 dates are cast for SQL