Bookings 0.1.3: Booking times follow the site's time zone correctly
Bookings 0.1.3 fixes the times of timed bookings. The module read the site’s time zone as one fixed offset, so a booking made in September for a November slot was stored an hour off, and on a site with a named zone such as Europe/Tallinn every slot was shown and stored as UTC.
Times are now converted with the zone’s rules for that date. A span that crosses a daylight saving change, such as 02:30 to 03:30 on the night the clocks jump, is shown as unavailable in the slot grid and refused by both pickers, instead of being stored at a different length. Day and night stays are not affected.
Each new timed booking now records the site’s time zone in a new time_zone column, and validating a booking no longer reads the setting once per existing booking.
Upgrading
Needs phoenix_kit 2.14 or later. Run mix phoenix_kit.update to apply the module’s migration V2.
Full release notes: Bookings 0.1.3
0.1.3 · 6 September 2026
The site’s time frame stops being one number. Everything below follows from that: a booking made in September for a November slot was stored an hour early, and on a site using an IANA timezone id every slot was rendered and stored as plain UTC.
Changed
-
⚠️ Requires
phoenix_kit ~> 2.14(was~> 2.4). Three things this module calls only exist, or only work, above that floor, and all three fail in the consumer’s app rather than here — the workspace always resolves the newest core:Utils.Date.shift_to_offset/2andparse_datetime_local/2resolve a zone per instant only from 2.14.1, when core routed them throughUtils.TimeZone. Below that they addedoffset_to_seconds/1, which wasFloat.parse/1and answered0for every IANA id — so the frame rewrite below would collapse to UTC and ship as a no-op. Unlike a missing function this raises nothing; it just stores the wrong instants.<.nav_tabs>, used by the admin filter strips, reached its adoptable form in 2.13.5.Utils.Slug.put_slug/3, the existing 2.4.0 floor.
Still two-segment, so every later 2.x satisfies it.
core_pin_conformance_test.exsmoved with it and now records all three reasons. -
The site frame resolves the zone at the instant being converted.
Engine.frame_to_utc/utc_to_frameused to addoffset_to_seconds/1of the"time_zone"setting — one scalar, applied to every date. Core’s own docstring now calls that “a snapshot of the offset now” and points callers doing arithmetic across a daylight-saving boundary atTimeZone.shift/2andfrom_wall/2; both directions go through those now. Newto_frame/2andfrom_frame/2,3take an explicit zone (an IANA id or a legacy fixed offset), and microseconds survive the round trip.A wall clock that never happens resolves to the instant the clocks jump to; one that happens twice resolves to the first occurrence — core’s rules, not invented ones. Day/night services still touch no clock time at all.
-
Engine.bookings_to_events/3andblocking_events/2take an optional zone, andvalidate_request/5resolves it once for the whole validation.site_tz/0is a settings query, and converting both ends of every active booking was making one per conversion — 43 queries to validate against 20 active bookings, on every advisory check and again inside the locked create.
Added
-
bookings.time_zone(migration V2): the site’s zone value at the moment a timed booking was made. A booking’s instants are UTC and the wall clock the customer picked lived only in the site’s zone at that moment — so when that setting moved to IANA ids and the frame turned out to have read it as one number, the existing rows could not be repaired: nothing recorded which zone each was made in. Nullable (day/night bookings carry no zone, and neither do rows written before V2).The chain now reports its applied version from a
bookings_schema:<N>comment on the services table, the convention the CRM and projects chains use. A marker-less install whose tables exist reads as V1, anddown(version: 1)drops only what V2 added. -
Engine.frame_span_intact?/5— true when the instants a frame-local span’s wall clocks resolve to are as far apart as the clocks say. The slot grid marks a span that fails it:unavailable, and both public pickers refuse one outright.
Fixed
-
A booking could be stored as a different length than the one picked. Two Sundays a year a day is not 24 hours long, and the rules engine builds its grid from minutes without knowing that. On
Europe/Tallinn, picking 02:30–03:30 on a spring-forward Sunday asked for an hour, stored thirty minutes (03:00–03:59 never happens, so the end resolved to 04:00), and was then validated as a ninety-minute span — which a free-form service with a 30-minute minimum accepts. The 90-minute event then blocked other people’s availability.Free-form services were fully exposed: they render no slot grid, so the grid’s guard never saw the pick.
pick_slotwas exposed too — its start and end come from the client, so marking a button unavailable was a display fact, not a server-side one. Both pickers now check the span before building a range.
Bookings 0.1.3. Install or update: {:phoenix_kit_bookings, "~> 0.1"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.