obsidian-periodic-notes icon indicating copy to clipboard operation
obsidian-periodic-notes copied to clipboard

Weekly Notes Templates is not working

Open pourmand1376 opened this issue 1 year ago • 6 comments

Hi, Thanks for creating this awesome obsidian plugin. I've been using your plugin for some time now. It is odd to me that the template for daily notes and monthly notes and yearly notes are working properly but the weekly notes template is not.

For example, I use this template at the top of my daily notes files and It actually replaces it with corresponding dates.

[[{{date:gggg-[W]ww}} | برنامه این هفته]] - [[{{date:gggg-MM}} | برنامه این ماه]] - [[{{date:gggg-[Q]Q}} | برنامه این فصل]] - [[{{date:gggg}} | برنامه امسال]]

But when I use this one for weekly notes, it doesn't replace any of those values:

[[{{date:gggg-MM}} | برنامه این ماه]] - [[{{date:gggg-[Q]Q}} | برنامه این فصل]] - [[{{date:gggg}} | برنامه امسال]]

and If I click the generated file, it says: "Filename can not contain any of the following characters". It is because it hasn't still replaced those values with an actual date.

What should I do?

More Information: I also use this code to see my week at a glance and it is working very well.

[[{{saturday:gggg-MM-DD}}|شنبه]] -[[{{sunday:gggg-MM-DD}} | یک شنبه]] - [[{{monday:gggg-MM-DD}}| دوشنبه]] - [[{{tuesday:gggg-MM-DD}}| سه شنبه]] - [[{{wednesday:gggg-MM-DD}}|چهارشنبه]] - [[{{thursday:gggg-MM-DD}}| پنج شنبه]] - [[{{friday:gggg-MM-DD}}|جمعه]]

It seems that date and time variables are not injected into weekly notes properly.

pourmand1376 avatar Jan 29 '23 08:01 pourmand1376

I think the problem is that the date is mutated here: https://github.com/liamcain/obsidian-periodic-notes/blob/main/src/main.ts#L218

I tried to fix this, but I can't get my fork to be loaded via BRAT.

A simple solution could be to replace this line with:

const filename = date.clone().format(format);

@liamcain could you please check if this is a viable solution. Happy to send a PR or for you to add it. Would be great as this should solve a lot of issues.

When I use {{date}} in my weekly template I get 2023-W11 which is exactly the format I have for the weekly note.

lukasoppermann avatar Mar 16 '23 11:03 lukasoppermann

I think the problem is that the date is mutated here: https://github.com/liamcain/obsidian-periodic-notes/blob/main/src/main.ts#L218

I tried to fix this, but I can't get my fork to be loaded via BRAT.

A simple solution could be to replace this line with:

const filename = date.clone().format(format);

@liamcain could you please check if this is a viable solution. Happy to send a PR or for you to add it. Would be great as this should solve a lot of issues.

When I use {{date}} in my weekly template I get 2023-W11 which is exactly the format I have for the weekly note.

you need to create a new release on your forked repository which points to the one commit you added in order for BRAT to pick it up. the release assets should also contain the main.js, manifest.json and styles.css (if applicable)

GamerGirlandCo avatar Apr 03 '23 23:04 GamerGirlandCo

Yeah, I did try but it did not work. Feel free to copy the change over and create a release. It would be great to be able to use it.

The release script had to many issues on my setup to get it to run. No idea why.

lukasoppermann avatar Apr 04 '23 06:04 lukasoppermann

@lukasoppermann i pulled your PR into my fork, and built and released it manually. i also added a couple changes of my own that add time calculations to the weekly note template parser.

https://github.com/GamerGirlandCo/obsidian-periodic-notes/releases/tag/1.0.0-beta.4

GamerGirlandCo avatar Apr 04 '23 15:04 GamerGirlandCo

@lukasoppermann @GamerGirlandCo will either of you open a PR with those changes to get them upstreamed here? Would be nice to have this be fixed for the wider community, and installable from the plugin manager without manual intervention.

Also I discovered this issue seems to also affect the monthly, quarterly, and yearly notes as well 😔

cewood avatar May 06 '23 06:05 cewood

Hey @cewood I actually found out that this did not completely solve the issue.

lukasoppermann avatar May 08 '23 07:05 lukasoppermann