Why does the API return 26/02 as the campaign sync end date, when in Campaign Settings, I set it up to finish on 27/02?.
When a user creates a campaign, and they set the start date to be 27/01, that means the campaign will start syncing ideas at midnight (00:00) on 27/01 in the local timezone of the user who created the campaign. The same applies to the campaign end date - a campaign set up to finish on 27/02 will stop syncing ideas on 27/02 at 23:59:59 local time.
Sideways 6 then takes those sync start and end times, in the user's local time, converts them to UTC timestamps, and saves them into the database in UTC. This means that a campaign created by a user based in Italy (UTC+1 at the moment) that starts on 27/01 and finishes on 27/02 will be saved in the database as starting on 26/01 23:00 UTC and finishing on 26/02 22:59:59.
β
The dates that you receive through the API are in UTC. As in the example above, this can sometimes mean that the data the user of your dashboards sees is different from what they can see in the Sideways 6 platform, depending on the setup of your dashboards. Our recommendation varies based on what you would like to achieve:
If you want consistency between the platform and your dashboards, parse the date received via the API as UTC and display it in the dashboard user's local time
If you want the dates shown to be the same for every user, parse the date from the API as UTC and display it on dashboards in UTC
If you want the dates to always start at midnight and finish just before midnight on the correct dates, you will need to parse the dates you get from the API as UTC and display them in the campaign creator's timezone to everyone, if you know which timezone that was
Please note that re-saving the same campaign start/end date by a user in a different timezone changes what date is actually saved in the database and exposed through the API, although to the editing user this will always appear as midnight in their local timezone.
