Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moment.js template values overridden by Periodic Notes #226

Open
esodesod opened this issue Aug 20, 2024 · 0 comments
Open

moment.js template values overridden by Periodic Notes #226

esodesod opened this issue Aug 20, 2024 · 0 comments

Comments

@esodesod
Copy link

Background

I'm using YAML Front Matter / Obsidian Property created: to set a static value when the file was created like this:

test: {{date:YYYYMMDDHHmm}}

Based on moment.js format, I expect this value to translate to YYYYMMDDHHmm, e.g. 202408200954 if the file was created on 2024-08-20 (year-month-date) at 09:54 (local time).

Finding

When using Periodic Notes and e.g. the moment.js template mentioned above (also seen in the screenshot below), I'm getting different values (e.g. different days), based on what note type I create; where I expect the template value to be identical (based on the template and moment the note is created). Does Periodic Note override the moment.js template values, somehow - for inline data?

To reproduce

  • Create a template to be used for all note types, using the moment.js value of {{date:YYYYMMDDHHmm}} as variable.
  • Set the template to be used for all note types.
  • Create new notes for daily, weekly, monthly, quarterly and yearly (all based on the very same template)
  • Notice different moment values, even though it's created within the same "moment" using the same template.

Example

All notes created at 2024-08-20 on 09:54 (local time)

  • Value for weekly is converted to last sunday (2024-08-18)
  • Value for monthly get converted to first day of the month (2024-08-01)
  • etc.

template and resulting notes, all created within the same minute.
image

(default settings, just enabled all note types, and used same template)
image

Other

  • Timestamp seems to be correct, the "overrides" seems to be limited to dates (maybe more, I haven't tested every combination from moment.js docs).

Debug info

SYSTEM INFO:
Obsidian version: v1.7.0
Installer version: v1.6.5
Operating system: Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 23.5.0
Login status: logged in
Catalyst license: supporter
Insider build toggle: on
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 1
Plugins enabled: 1
1: Periodic Notes v0.0.17

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

No branches or pull requests

1 participant