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

NaN as output if I use the + sign #1015

Open
merlinuwe opened this issue Jan 30, 2023 · 6 comments
Open

NaN as output if I use the + sign #1015

merlinuwe opened this issue Jan 30, 2023 · 6 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@merlinuwe
Copy link

merlinuwe commented Jan 30, 2023

Hi,

when I use the plus sign

creation_date: <%+ tp.file.creation_date("dddd, DD. MMMM YYYY, HH:mm:ss") %> Uhr

modification_date: <%+ tp.file.last_modified_date("dddd, DD. MMMM YYYY, HH:mm:ss") %> Uhr

as mentioned here https://silentvoid13.github.io/Templater/commands/dynamic-command.html

I get NaN in the file made with this template.


# <%+ tp.file.title %>

does also give NaN.

Windows 10, latest plugins, latest obsidian.

@merlinuwe merlinuwe added the bug Something isn't working label Jan 30, 2023
@welpdx
Copy link
Contributor

welpdx commented Jan 30, 2023

Couldn't replicate bug. Switching to Preview mode from Edit mode displays the correct result from the dynamic command.

Windows 11 Home 22H2
Obsidian v1.1.9 (No other plugin installed other than Templater)
Templater v1.16.0

img


Ok I think I get your problem though.
When ever you insert template or create a new note with template, the dynamic code is executed instead of simply copying the dynamic code over as text.

Possibly the same issue as #910

@Zachatoo
Copy link
Collaborator

Zachatoo commented Feb 1, 2023

I highly recommend using dataview for this purpose instead, it works way more reliably for dynamic content, which is why this issue came up to deprecate dynamic commands at some point #913

@welpdx
Copy link
Contributor

welpdx commented Feb 1, 2023

@Zachatoo Ah I see! That's why the function was nominated for deprecation!

@afcuttin
Copy link

Ok I think I get your problem though.
When ever you insert template or create a new note with template, the dynamic code is executed instead of simply copying the dynamic code over as text.

This is the actual issue, that I have, too.

@BarryBurton57
Copy link

BarryBurton57 commented Jun 13, 2023

I highly recommend using dataview for this purpose instead, it works way more reliably for dynamic content, which is why this issue came up to deprecate dynamic commands at some point #913

@Zachatoo How would you use dataview for this purpose though? Do you mean insert a dataview query in the template file?

@Zachatoo
Copy link
Collaborator

Yes, exactly. Other plugins tend to work great with Templater in this regard.

<% tp.file.title %>
More of whatever...

```dataview
dataview stuff
```

Or inline dataview `= this.whatever`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

5 participants