Fix timezone mismatch: store/compare scheduled_at in UTC

JS was sending browser-local time; dispatcher compared against server UTC,
so posts scheduled in UTC+3 appeared 3h in the future to the dispatcher.

- JS helpers: utcToDate, utcToLocalInput, localInputToUTC
- All scheduled_at values sent to server are now converted to UTC
- Stored values are displayed converted back to browser local time
- relTime and fmtDT parse stored UTC timestamps correctly
- dispatch-social.php: gmdate() for $now (UTC) + sent_at

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-06-04 21:07:42 +03:00
parent 9af6326be2
commit 30242ae470
2 changed files with 22 additions and 12 deletions

View file

@ -14,7 +14,7 @@ require ROOT . '/lib/bootstrap.php';
$lock = fopen(sys_get_temp_dir() . '/hackman_social.lock', 'c');
if (!$lock || !flock($lock, LOCK_EX | LOCK_NB)) exit(0);
$now = date('Y-m-d H:i:s');
$now = gmdate('Y-m-d H:i:s');
$stmt = $db->prepare("
SELECT t.id AS target_id, t.post_id, t.project_id, t.platform, t.target_key, t.include_image,