Skip to content

Publishing 0.8.0: Timestamp posts follow the site's time zone

Publishing 0.8.0 fixes timestamp posts on sites with a time zone set. Post dates, scheduled releases and RSS feed dates ran on UTC while the editor showed the site’s clock. They now all follow the site’s time zone.

Timestamp posts ran on UTC

The site’s time zone setting holds a zone name such as Europe/Tallinn. Publishing read it as a whole number of hours, so a zone name, or an offset like 5.5, became zero. On every site that had picked a time zone in the settings, three things ran on UTC:

  • A post created at 01:00 local time could be filed under the day before.
  • A post scheduled for 06:00 on a UTC+3 site went live at 09:00 local time.
  • Every pubDate in the RSS feed was off by the site’s offset.

All three now convert with the site’s real zone, on the date being converted, so summer and winter time are handled.

Scheduled posts around the clock change

When clocks went back in autumn, a scheduled post could go live and then show as scheduled again for most of an hour, because the same local time came round twice. A post set for 02:45 in Warsaw on 25 October 2026 would have gone out and then reverted. Release now turns the post’s date and time into the exact moment it names in the site’s zone and compares that with the current time in UTC.

Faster feeds and listings

The RSS feed read the time zone setting from the database twice per item, so a 50-item feed made 100 queries for it. It now reads it once per feed. Public listings now decide whether a post is still scheduled with a quick date check and look up the zone only for posts close to the current time.

Upgrading

Publishing 0.8 needs PhoenixKit 2.14 or later, because core’s date helpers only understand zone names from 2.13.9. On an older core the fix would do nothing. There is no migration. After the upgrade, timestamp post dates, release times and feed dates follow the site’s zone. Code that called Constants.site_offset_seconds/0 or scheduled_ahead?/2 must move to site_tz/0, to_site_wall/2, from_site_wall/3 and scheduled_ahead?/3.

Full release notes: Publishing 0.8.0

0.8.0 · 6 September 2026

Changed

  • ⚠️ Requires phoenix_kit ~> 2.14 (was ~> 2.4). Constants.to_site_wall/2 and from_site_wall/3 resolve the site time_zone through core’s Utils.Date.shift_to_offset/2 and parse_datetime_local/2, and both of those only became IANA-aware in core 2.13.9 — before that they parsed the setting with offset_to_seconds/1, a Float.parse/1 that reads Europe/Tallinn as 0. On an older core the timezone fix below is a silent no-op: every timestamp post is stamped, released and syndicated on UTC while the editor shows the site’s clock, with a green build and no warning. The true floor is 2.13.9, rounded up to the nearest minor to keep the ecosystem’s ~> X.Y shape.

  • Publishing.Constants timezone API (post-merge review of PR #45). site_offset_seconds/0 is gone, replaced by site_tz/0 (the setting as core keeps it) plus the conversion pair to_site_wall/2 and from_site_wall/3. scheduled_ahead?/2 is replaced by scheduled_ahead?/3, which takes true UTC now and the zone so a whole-listing pass reads settings once. No caller exists outside this package in the phoenix_kit* ecosystem.

Fixed

  • Timestamp posts ran on UTC on every site that had touched the timezone picker (PR #45). Constants.site_offset_seconds/0 read the time_zone setting with Integer.parse/1 and required an empty remainder, so an IANA id — what the setting holds since core 2.13.9 — and a fractional "5.5" both became 0. Post stamping, scheduled release and the feed’s pubDate all ran on UTC while the editor showed the site’s clock: a post created at 01:00 local was filed under yesterday, one scheduled for 06:00 on a UTC+3 site went live at 09:00 local, and every feed item was off by the site offset. The three consumers now share to_site_wall/2 and from_site_wall/3, both resolving the zone on the date being converted.

  • A scheduled post flickered back to “scheduled” for most of an hour, once a year (PR #45). Release compared the post’s site wall clock against a wall-clock “now”, and a wall clock is not monotonic across a fall-back hour: a post set for 02:45 in Warsaw on 2026-10-25 went out at its first 02:45 (00:45Z) and reverted at 01:00Z when the clock read 02:00 again, on every public path. The post’s date and time are now read back as the instant they name in the site’s zone and compared with true UTC now.

  • The RSS feed issued one settings query per item, twice over (post-merge review of PR #45). effective_datetime/1 called from_site_wall/2, whose default argument is an uncached Settings.get_setting/2 — and it runs once per <item> and again for every post in lastBuildDate, so a 50-item feed went 100 database round-trips deep to answer a question whose answer cannot change mid-document. The zone is now read once per feed document and threaded through.

  • The public listing paid ~30x more per post to decide whether it was scheduled (post-merge review of PR #45). scheduled_ahead?/3 runs over the listing cache (up to 5,000 entries) on every public request, and resolving a zone costs ~25 ms per 5,000 where the DateTime comparison it replaced cost ~0.8 ms. A wall clock runs at most 14 hours ahead of UTC and 12 behind, so a post two whole days clear of now’s UTC date is now decided by Date.diff/2 alone and only near-boundary posts resolve the zone. A test cross-checks the shortcut against the full resolution over 126 zone/day/hour combinations rather than asserting its own arithmetic.

  • Dependency updates: phoenix_kit 2.13.5 → 2.15.1 and the transitive set it pulls (phoenix 1.8.13, phoenix_live_view 1.2.11, phoenix_pubsub 2.3.0, oban 2.24.1, leaf 0.6.1, req 0.7.4, mint 1.10.0, hammer 7.5.0, phoenix_kit_comments 0.4.5, and others).


Publishing 0.8.0. Install or update: {:phoenix_kit_publishing, "~> 0.8"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.