licoe
April 17, 2024, 9:49am
1
What I’m trying to do
I use daily notes for planning, tasks, and habits. And I need different templates to be used for different days of the week and month.
For example: If the note is for Sunday, then “Template Sunday” is used, and the other days “Template Day”. And the template for a specific day of the month is “Template 1st day of the month”
I have to make an important remark - Template should not be applied according to the day of creation, but according to which day this daily note belongs to. If I create a note for Monday and today is Sunday, Template Sunday should not be applied to it.
Daily notes format - YYYY-MM-DD
Things I have tried
I am not proficient in programming and so it is very difficult for me to figure out on my own, but I have read and tried to apply information from the following sources:
Hi all,
What I’m trying to do
I’m trying to re-create weekday templates I used in Roam before seeing the light.
I want a template that will display different content depending on the day of the week (today’s weekday on creation) and exclude content intended for other weekdays
It seems the templater plugin would be best?
Something like:
IF day of week = monday Today is Monday
IF day of week = tuesday Today is Tuesday
…and if I use the template on a Monday, “Today is Monday” would appear …
Hello,
I’m wondering if someone can help me figure out how to use Templater to construct different daily notes for each day of the week (mon, tues, etc.). The idea being to have daily notes reflect my periodic chores/practices based on the day; e.g. Monday might be laundry day. Tuesday might be meditation, etc.
Is there a way to use Templater to do this? I’ve been unable to find a solution by searching the forum but perhaps I’ve missed something? Can anyone make some suggestions - I have a fe…
https://www.reddit.com/r/ObsidianMD/comments/r80fk3/comment/hn33o8j/
https://www.reddit.com/r/ObsidianMD/comments/vtqo4e/different_templates_for_different_weekdays_in/
Things I have tried
I believe templater can be handy, but I’ve never used it and ideally would like to find a solution that doesn’t involve coplexify my vault further.
I’m trying to schedule different tasks based on the day of the week.
For example, I want some tasks to show-up Mon. and Fri., others all weekdays and some on Sat. only, is this possible at all?
If yes, do you have any suggestion on how to achieve it?
Thank you
What I’m trying to do
I’ve been wanting to solve this problem for a long time, and it’s literally taking up all my attention. I would be very happy if you could help me
Hi,
I hope this would be helpful to you, I use a template like this: (Made initilly by some kind soul on this forum, sorry I forgot who and where, and adapted by me:)
<%*
const dayOfWeek = Number(tp.date.now(“d”, 0, tp.file.title, “YYYY.MM.DD”));
const dayOfMonth = Number(tp.date.now(“D”, 0, tp.file.title, “YYYY.MM.DD”));
const month = Number(tp.date.now(“M”, 0, tp.file.title, “YYYY.MM.DD”));
const year = Number(tp.date.now(“YYYY”, 0, tp.file.title, “YYYY.MM.DD”));
const lastDayOfMonth = Number(month === 2 ? ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0 ? 29 : 28) : [4, 6, 9, 11].includes(month) ? 30 : 31);
const doLastDOM = Boolean([1,2,3].includes(dayOfWeek) ? dayOfMonth === lastDayOfMonth : dayOfWeek == 4 ? dayOfMonth >= (lastDayOfMonth - 3) : false);
if (dayOfWeek == 1) {
// Monday
-%>
Things for monday <% tp.file.title %>
<%*
}
else if (dayOfWeek == 2) {
// Tuesday
-%>
Things to do on tuesday <% tp.file.title %>
<%*
}
else if (dayOfWeek == 3) {
// Wednesday
-%>
do stuff <% tp.file.title %>
<%*
}
else if (dayOfWeek == 4) {
// Thursday
-%>
do stuff <% tp.file.title %>
<%*
}
else if (dayOfWeek == 5) {
// Friday
-%>
Do stuff friday <% tp.file.title %>
<%*
}
// End of Month Tasks
if (dayOfMonth == 01) {
-%>
Anything you want
Do stuff and schedule them for the first monday of the current month <% tp.date.weekday(“YYYY-MM-DD”, 8, tp.file.title, “YYYY-MM-DD”) %>
<%*
}
-%>
Good luck!
Edit to add: You will have to add “if” statements for Saturday and Sunday, and for any other date you might need.
licoe
April 17, 2024, 1:18pm
3
Thanks, but I need a specific template to be applied, not just adding some text.
Something like this:
If day of week - Sunday
[[Template Sunday]]
1 Like
system
Closed
July 16, 2024, 1:19pm
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.