Skip to content

fix: name daily notes with Do and [literal] formats like Obsidian - #153

Open
jayhemnani9910 wants to merge 1 commit into
Yakitrak:mainfrom
jayhemnani9910:fix/daily-format-ordinal-literal
Open

jayhemnani9910 wants to merge 1 commit into
Yakitrak:mainfrom
jayhemnani9910:fix/daily-format-ordinal-literal

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

Description

daily now formats the note name and {{date:FORMAT}} template variables with a new obsidian.FormatMomentDate. It reads the Moment format left to right:

  • Do becomes the day with an English ordinal (3rd, 12th, 21st).
  • [text] is copied as is, without the brackets.
  • Every other token goes through the existing token table, now shared with MomentToGoFormat, which is unchanged.

Motivation and Context

With the daily notes format dddd, MMMM Do YYYY, Obsidian names today's note Thursday, December 3rd 2026.md, but daily creates Thursday, December 3o 2026.md. Do is not a known token, so D becomes the day and the o is left over. Text in brackets is not treated as literal, so [Journal] comes out as [Journpml] and YYYY-MM-DD [at] HH:mm in a template gives 2026-12-03 [pmt] 12:58. daily therefore never finds the note Obsidian made for today, and daily -c appends to a second, misnamed note.

Checklist:

  • I have written unit tests for my changes.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.

Tests: TestFormatMomentDate (ordinals including 12th/21st, a bracketed literal) and a daily test with [Journal] MMMM Do YYYY. The daily test fails on main ([Journpml] December 3o 2026.md) and passes with this change. go test ./... and go vet pass.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant