Background
During T377826: MPIC: UI improvements for the catalog table, we found that at least the start_date and end_date fields of an instrument (or A/B test) are stored as strings in the frontend. To improve flexibility (date comparison in JavaScript uses mathematical operators) and localisability, we should represent them using the Date class.
Proposal
- Represent dates as strings in ISO 8601 format in the API
- When an API response is received, construct a new instance of Date from the string
- When a new instrument is being constructed:
- Set the start_date property to a new Date instance; and
- Set the end_date property to a Date instance representing the date that the user selected
- Use Date.toLocaleDateString() (UTC everywhere all at once) to render dates whenever they need to be shown to the user