Skip to content

Set title of created note to GCal date #197

Answered by YukiGasai
mgorfer asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, because you use templater you can use window.moment to format the dates.
Here is an example that should achive the required things.

---
type: event
location: "{{gEvent.location}}"
date_all_day: "{{gEvent.start.date}}"
date_start: "{{gEvent.start.dateTime}}"
date_end: "{{gEvent.end.dateTime}}"
MOCs:
  - "[[Events MOC]]"
  - "[[<% window.moment('{{gEvent.start.date}}' != '' ? '{{gEvent.start.date}}' : '{{gEvent.start.dateTime}}').format('YYYY-MM-DD-dddd') %>]]"
summary:
---
<% await tp.file.move("/Extras/Events/" + window.moment('{{gEvent.start.date}}' != '' ? '{{gEvent.start.date}}' : '{{gEvent.start.dateTime}}').format('YYYY-MM-DD') + " " + tp.file.title) %>
# [[<% window.moment('{{gE…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mgorfer
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants