Changeset 015ce46 in Klonkt for src/services/Scheduler.js


Ignore:
Timestamp:
06/21/2026 04:32:54 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
9effb80
Parents:
5a394e5
Message:

fix(inplannen): scheduled posts never went live + timezone bug

(1) Scheduler compared publish_at (ISO 'T..Z') string-wise with SQLite
CURRENT_TIMESTAMP ('YYYY-MM-DD HH:MM:SS'); because 'T' > space the condition
was never true → scheduled posts NEVER flipped to published. Now
datetime(publish_at) <= datetime('now') (both UTC, same format).
(2) datetime-local was stored as UTC without timezone → 18:10 CEST became
18:10 UTC (= 20:10 local). Now: client converts local input to UTC ISO on save,
pre-fills the field from UTC→local, and shows "Scheduled for" in readable local
time instead of raw UTC ISO.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/Scheduler.js

    r5a394e5 r015ce46  
    1616      SELECT p.id, p.title, p.content, u.username
    1717      FROM posts p JOIN users u ON u.id = p.author_id
    18       WHERE p.status = 'scheduled' AND p.publish_at IS NOT NULL AND p.publish_at <= CURRENT_TIMESTAMP
     18      WHERE p.status = 'scheduled' AND p.publish_at IS NOT NULL AND datetime(p.publish_at) <= datetime('now')
    1919    `).all();
    2020    if (!due.length) return 0;
Note: See TracChangeset for help on using the changeset viewer.