Runway - Importing dates
I have been happily creating items in a collection (through the admin pages) that have a date field - quite a basic field:
<perch:content id="gamedate" label="Game Date" type="date" title="true" />
The date is saved in the database as
2017-03-24 for example.
I've been creating an import script to get a whole load of entries into the same collection - the dates are being imported from a CSV in the same format -
2010-09-04. This date is saved in the database as
2010-09-04 00:00:00 (Using the same template above as the basis for the import).
One of my pages is filtering the items by the date, but as they can end up being stored in two different formats, the query doesn't always return the correct result. The date to filter by is being passed in the url in the format
I can get round this by adjusting my filter to look for both formats:
'filter' => 'gamedate', 'match' => 'in', 'value' => perch_get('gamedate').','.perch_get('gamedate').' 00:00:00'
but this doesn't "feel right" having the date being stored in two formats for similar items.