From f5478a0ce046a9a82db0ca5e60b24dfa89963950 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 8 Oct 2026 14:33:11 -0400 Subject: [PATCH] The export and the Markdown frontmatter write times through common.iso common.iso is the server's one way to put a datetime on the wire, yet the JSON export and the importer's Markdown frontmatter wrote out the x.isoformat() if x else None idiom it replaces, seven times. Same output. DRY pass #2, batch 4, F10 (#5372). Co-Authored-By: Claude Opus 5.5 --- src/inkwell/notes/__init__.py | 8 ++++---- src/inkwell/notes/import_export.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/inkwell/notes/__init__.py b/src/inkwell/notes/__init__.py index 0d23f81..ab4132c 100644 --- a/src/inkwell/notes/__init__.py +++ b/src/inkwell/notes/__init__.py @@ -256,7 +256,7 @@ async def export_notes(): payload: dict = { "app": "inkwell", "version": 1, - "exported_at": datetime.now(timezone.utc).isoformat(), + "exported_at": iso(datetime.now(timezone.utc)), "labels": [{"name": lb.name, "color": lb.color} for lb in all_labels], "notes": [], } @@ -273,10 +273,10 @@ async def export_notes(): "body": n.body, "pinned": n.pinned, "archived": n.archived, - "remind_at": n.remind_at.isoformat() if n.remind_at else None, + "remind_at": iso(n.remind_at), "recurrence": n.recurrence, - "created_at": n.created_at.isoformat() if n.created_at else None, - "updated_at": n.updated_at.isoformat() if n.updated_at else None, + "created_at": iso(n.created_at), + "updated_at": iso(n.updated_at), "labels": [lb["name"] for lb in labels], "attachments": [ {"file": f"attachments/{short}/{os.path.basename(a.path)}", "mime": a.mime} for a in atts diff --git a/src/inkwell/notes/import_export.py b/src/inkwell/notes/import_export.py index 938bbd1..dee5cc1 100644 --- a/src/inkwell/notes/import_export.py +++ b/src/inkwell/notes/import_export.py @@ -11,7 +11,7 @@ from datetime import datetime, timezone from sqlalchemy import select -from ..common import parse_dt +from ..common import iso, parse_dt from ..models.label import NoteLabel from ..models.note import Note from .helpers import ( @@ -37,9 +37,9 @@ def _note_markdown(note: Note, labels: list) -> str: if note.archived: fm.append("archived: true") if note.remind_at: - fm.append(f"remind_at: {note.remind_at.isoformat()}") - fm.append(f"created: {note.created_at.isoformat() if note.created_at else ''}") - fm.append(f"updated: {note.updated_at.isoformat() if note.updated_at else ''}") + fm.append(f"remind_at: {iso(note.remind_at)}") + fm.append(f"created: {iso(note.created_at) or ''}") + fm.append(f"updated: {iso(note.updated_at) or ''}") fm.append("---") fm.append("") # Body and checklist are no longer alternatives — a note can carry both, so both