Code Monkey home page Code Monkey logo

Comments (8)

SilentVoid13 avatar SilentVoid13 commented on May 25, 2024 1

@dummifiedme @TSSlade: There are some known issues with powershell and Templater that I haven't been able to resolve for now.
However if you want to get today's date minus a day offset, you can with the new internal template {{tp_date}}. With this, you're now able to specify a date offset as argument like so: {{tp_date:offset="-3"}}. You can also specify the date format with the f argument, i.e. {{tp_date:offset="-3",f="yyyy-MM-dd"}}.
Update Templater to 0.5.7 to use it !
I'm closing this because it's similar to #9 or #15 for powershell problems, but don't hesitate to re-open this if you have any problem using {{tp_date}}

from templater.

benwalio avatar benwalio commented on May 25, 2024

what error is obsidian throwing? i just tried it on mine (not using powershell, macos terminal) but it didn't have any issues creating a note with the same general link format that you posted above

Screen Shot 2021-01-07 at 19 49 19

from templater.

dummifiedme avatar dummifiedme commented on May 25, 2024

The Obsidian error is like a notification, I am not able to read it. In the editor though, it just doesn't convert to the expected date but stays just as the template {{}}.

Can you share the Templater command that you used?

from templater.

benwalio avatar benwalio commented on May 25, 2024

mines going to be different because I'm using the OSX date command but here it is: date -j +"[[%Y-%m-%d_%a|%Y-%m-%d]]"

from templater.

TSSlade avatar TSSlade commented on May 25, 2024

I can affirm a similar experience to @dummifiedme's. My console (Ctrl+Shift+I) provides the following:

Failed to load resource: net::ERR_CONNECTION_REFUSED
(unknown) Error with the template nĀ° 2:
 Error: Command failed: powershell echo "[[$((Get-Date).AddDays(-7) | Get-Date -UFormat "%Y-%m-%d")]]"

    at ChildProcess.exithandler (child_process.js:312)
    at ChildProcess.emit (events.js:310)
    at maybeClose (internal/child_process.js:1021)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286)

If I remove the powershell prefix from the custom template command and just lead with echo, I get the following result (in context):

Previous meeting in series: [[{{"Get-Date -UFormat "%Y-%m-%d")"}}_05h00]]

That is not an error, but it's also not the desired outcome. Any chance the plugin is having a hard time launching/communicating with the Powershell executable?

from templater.

TSSlade avatar TSSlade commented on May 25, 2024

Further follow-up: using the custom templates in the README:

image

a.k.a.

powershell (Get-Date -UFormat '%Y-%m-%d' (Get-Date).addDays(-1))

...added like so:

image
...these are the results:

image

from templater.

dummifiedme avatar dummifiedme commented on May 25, 2024

As far as I remember, I was able to get correct output when using a simple format, the problem arose when I decided to use square brackets and vertical bar in there.

But there must be something missing in the templater for sure.

from templater.

TSSlade avatar TSSlade commented on May 25, 2024

Confirmed that even with neither square brackets nor a pipe present, I experience the same failure mode:

image

from templater.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.