All times are offset by my timezone offset
Just got semaphore setup, im using postgres for my database and i just noticed that every time i run a task it gives me a "last run" of 6 hours ago... im in the America/Denver TZ which is -6:00UTC. I took a look at the api calls the client is making and the times coming back from the server are the same hour as my current TZ but marked as UTC (Z), i would expect to see times that are 6 hours "in the future" if its marked as UTC. heres the result of the templates api call
Notice the last_task.start is 2022-06-24T08:20:07.141037Z, i would expect this to be 2022-06-24T14:20:07.141037Z (14 instead of 8) since it is UTC (Z)
[
...other tasks...,
{
"id": 3,
"project_id": 1,
"inventory_id": 1,
"repository_id": 1,
"environment_id": 1,
"name": "Nextcloud cron.php",
"playbook": "./playbooks/nextcloud_cron.yaml",
"arguments": null,
"allow_override_args_in_task": false,
"description": null,
"vault_key_id": null,
"type": "",
"start_version": null,
"build_template_id": null,
"view_id": null,
"last_task": {
"id": 814,
"template_id": 3,
"project_id": 1,
"status": "success",
"debug": false,
"dry_run": false,
"playbook": "",
"environment": "",
"user_id": null,
"created": "2022-06-24T08:20:00.00206Z",
"start": "2022-06-24T08:20:07.141037Z",
"end": "2022-06-24T08:21:07.71578Z",
"message": "",
"commit_hash": null,
"commit_message": "",
"build_task_id": null,
"version": null,
"arguments": null,
"tpl_playbook": "./playbooks/nextcloud_cron.yaml",
"tpl_alias": "Nextcloud cron.php",
"tpl_type": "",
"user_name": null,
"build_task": null
},
"autorun": false,
"survey_vars": null,
"suppress_success_alerts": false
}
]
I could totally have this setup incorrectly so LMK if theres a way for me to fix this on my end. My browser is in -6UTC, my server im running both semaphore and postgres on are also -6UTC, and im running semaphore and postgres in docker containers with docker-compose and passing in a volume for /etc/localtime so the containers should be in -6UTC as well
Hi @kevindurb Reproduced, thank you!
Hi @kevindurb
I totally misunderstand how Postgres timezones work.
You can add timezone to semaphore's config.json:
"postgres": {
"host": "localhost",
"user": "postgres",
"pass": "pwd",
"name": "semaphore",
"options": {
"sslmode": "disable",
"timezone": "Asia/Yekaterinburg"
}
}
But it doesn't work to me, as well as PGTZ environment variable for Postgres container.
Documentation says:
If no time zone is stated in the input string, then it is assumed to be in the time zone indicated by the system's TimeZone parameter, and is converted to UTC using the offset for the timezone zone.
But it doesn't work to me, I see local time in database, not UTC.