Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Plugin API: `logseq.Editor.createJournalPage("YYYY-MM-DD")` creates the previous day's journal west of UTC

Chiusa Adatta ai principianti
#1,400 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Una pull request collegata è già stata integrata.

  • #13597 di @tiensonqin — integrata

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
clojure, javascript
Ambito
api

Direzione di ricerca

Parti da create_journal_page in src/main/logseq/api/editor.cljs (righe 164-170), dove (js/Date. date) trasforma una stringa di sola data in mezzanotte UTC e il giorno viene poi letto dai campi locali; leggi gli helper gdate/date-time-util che chiama prima di modificare. Decidi se normalizzare una stringa YYYY-MM-DD nuda a mezzanotte locale in questa funzione o in un helper di data condiviso, e controlla le altre API dell'editor e il #1295 correlato per lo stesso pattern. Fatto significa che la chiamata del plugin restituisce la pagina di diario indicata nella stringa in una zona UTC negativa, ad es. sotto America/Chicago.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Search first
  • I searched and no similar issues were found
What Happened?

In a time zone west of UTC, logseq.Editor.createJournalPage("2026-12-01") creates (or returns) the journal page of the day before: "Nov 30th, 2026".

The SDK types the argument as string | Date, and a date-only string is the natural thing to pass. Seen in a plugin (@logseq/libs 0.3.4) in a DB graph, time zone UTC−5.

These inputs gave the intended day:

  • "2026-12-03T12:00:00" (a local date-time string)
  • a Date built from local fields
  • the local-midnight timestamp in ms
Reproduce the Bug
  1. Set the computer's time zone west of UTC (e.g. America/Chicago).
  2. Open a DB graph, and from a plugin run:
    const page = await logseq.Editor.createJournalPage("2026-12-01")
    console.log(page)
    
  3. The returned page is "Nov 30th, 2026".
Expected Behavior

The journal page of the day in the string: "Dec 1st, 2026", in every time zone.

Screenshots

No response

Files

No response

Browser, Desktop or Mobile Platform Information

macOS 26.6.2 (arm64), Logseq-DB.app 2.0.1, a local build of logseq/logseq 8ffbb22093 (built 2026-10-01), @logseq/libs 0.3.4, time zone America/Chicago (UTC−5). Seen in the app on 2026-10-04.

Additional Context

Investigation (at 8ffbb22093; the function is the same on master 22a29b30de)

  • Where: src/main/logseq/api/editor.cljs:164-170 @ 8ffbb22093, create_journal_page:

    (let [date (js/Date. date)]
      ... (-> (gdate/Date. date) (date-time-util/format "yyyy-MM-dd")) ...)
    
  • Why it fails (confirmed for the JavaScript part, by running it under three zones): new Date("2026-12-01") is midnight UTC, as ECMAScript defines for a date-only string, and the day is then read back from the local fields. West of UTC that is the evening of Nov 30. A string with a time and no offset is parsed as local time, which is why "2026-12-03T12:00:00" works.

    TZ "2026-12-01" → local day "2026-12-01T12:00:00" → local day
    America/Chicago 2026-11-30 2026-12-01
    UTC 2026-12-01 2026-12-01
    Asia/Tokyo 2026-12-01 2026-12-01

    So zones at or east of UTC are not affected.

  • Workaround in use: pass local noon, "YYYY-MM-DDT12:00:00".

  • Related: #1295 (a date-only Deadline / Scheduled changing day across zones; a different code path, the same class of day ↔ instant conversion).

Are you willing to submit a PR? If you know how to fix the bug.
  • I'm willing to submit a PR (Thank you!)
Lingua principale
Nessun dato sulla lingua
Stelle
28
Fork
2
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di logseq/db-test

Tutte le issue di logseq/db-test

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.