Repository navigation
Description
What happens
Deadline and Scheduled (type :datetime) store one number, a UTC millisecond timestamp. A value picked without a time is stored as local midnight on the device that picked it, and it shows no time only because the local clock reads 00:00 (frontend.components.property.value, the datetime display checks (= 0 hours minutes)). The zone that wrote the value is not stored, and neither is the fact that no time was chosen. Three consequences, each reproduced on master:
- Another zone reads another day. "Sep 23, no time" picked in Los Angeles is
1790146800000. Read in Tokyo it is Sep 23 16:00, so the date-only deadline now shows a time. Read in Honolulu it is Sep 22 21:00, so it shows a time and sits on the previous day's journal (ms->journal-dayreads the local day). A graph synced between devices in different zones, or opened while traveling, shows this. - A repeat drifts across DST.
get-next-timeadds the interval to the value as a UTC date-time. A weekly task scheduled for Sat 2026-10-31 (no time) and completed inAmerica/Los_Angelesis rescheduled to Fri 2026-11-06 23:00: one hour short, because US DST ends on Nov 1, so the next occurrence moves to the previous day and gains a time. In zones without a DST change that week it lands on Sat 2026-11-07 00:00. - Tests depend on the machine's zone. Code that builds a day with
journal-day->ms(midnight UTC) and reads it back withms->journal-day(local) disagrees with itself west of UTC. fix(test): build test dates in local time logseq#13430 fixes 3 tests of this kind that pass only in UTC, which is where CI runs.
Related: logseq/logseq#12538 (entries written in one zone missing on a device in another).
Proposal
Store what the user chose, and derive the instant from it.
- A date without a time stored as a day with no zone, the way journal pages already are (
:block/journal-day20261031) and the way:dateproperties already are (a reference to the journal page). It reads as the same day everywhere. Its journal ref is that day's page, with no conversion. - A date with a time stored as the wall-clock fields plus the zone's name, for example
2026-10-31T15:00andAmerica/Los_Angeles. The instant, when needed for sorting, reminders or "overdue", is computed from the two with the platform's time zone data (Intl.DateTimeFormatwithtimeZone, orTemporal.ZonedDateTimewhere available). A repeat adds its interval to the wall-clock fields in that zone, so a weekly 15:00 stays at 15:00 across DST.
The zone name matters, not only the UTC offset at the time of writing: the offset of the next occurrence can differ (DST, or a change in a country's rules), and only the name lets the time zone data answer that.
Migration
Existing values are timestamps without a zone, so the migration has to assume one. The device's current zone is the best available guess and is right for most graphs:
- a timestamp that is local midnight in that zone becomes a date without a time;
- any other timestamp becomes wall-clock fields in that zone plus the zone's name.
A value written on another device in another zone comes out as it reads on the migrating device today, which can be a different day or a time where none was chosen, as in case 1 above. After the migration it reads the same on every device.
This changes the stored schema, so it is filed as a proposal before any code.
Activity
yuxi-liu-wired commentedon Sep 25, 2026
A worked example of the DST case, reproduced on master in
America/Los_Angeles(US DST ends on Sun 2026-11-01; Los Angeles is UTC-7 before that day and UTC-8 after):get-next-time(frontend.worker.commands) converts the value withtc/to-date-time, a UTC date-time, and adds 1 week there: 7 × 24 hours.A task scheduled without a time is stored at local midnight, 2026-10-31 07:00 UTC. The same step gives 2026-11-07 07:00 UTC, which is Fri 2026-11-06 23:00 in Los Angeles: the task moves to the previous day and gains a time. In a zone without a DST change that week, the same task comes back on Sat 2026-11-07 00:00.
With the zone name stored next to the time, as proposed above, the repeat can add 1 week on the Los Angeles clock (for example
Temporal.ZonedDateTime.add({weeks: 1}), or cljs-time arithmetic on a local date-time) and keep 09:00, and keep Saturday for the task without a time. Adding in local wall-clock time would change whatget-next-time-testasserts (intervals of exactly 24 hours per day), so I have not opened that change; it seemed better to settle the storage question first.yuxi-liu-wired commentedon Sep 25, 2026
Another instance of the same class, already fixed: #693, where on iOS at GMT-6 tapping a future journal date in the picker selected the following day. Each of these comes from a day turned into an instant in one zone and read back in another.