Comments (8)
@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.
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
from templater.
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.
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.
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.
Further follow-up: using the custom templates in the README:
a.k.a.
powershell (Get-Date -UFormat '%Y-%m-%d' (Get-Date).addDays(-1))
...added like so:
from templater.
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.
Confirmed that even with neither square brackets nor a pipe present, I experience the same failure mode:
from templater.
Related Issues (20)
- [Feature request] Automatic templates ignore files setting
- Folder template (checkbox - include subfolders)
- Create new file from template HOT 2
- tp.date.now returns incorrect time. HOT 2
- Add native AI support HOT 2
- Add `<%*` tag to documentation HOT 1
- Templater script inserting newline before front matter HOT 3
- Don't Include Frontmatter in Output HOT 2
- Folder Notes take priority when creating file HOT 7
- Expand metadata in space - Geolocation coords support request
- Console error: app.js:1 No file creator assigned to create file with extension com. Falling back to markdown file creator. HOT 1
- Error: Failed to List Templates, No Template Folder Configured HOT 8
- Execution of the tp.file.selection() function erase the selection in the note HOT 2
- Add note about modified date to the FAQs / docs
- front matter formating number as a string HOT 1
- main.js missing HOT 3
- Date not rendered as link HOT 1
- 2.3.2 broke my frontmatter processing template HOT 5
- Auto jump to cursor is triggered twice on new file creation HOT 4
- invalid reference date format, try specifying one with reference format HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from templater.