Week Template Improvement
Opened this issue · 2 comments
Hi, I really enjoy working with the journal.
What I am missing is a way to prepare a whole week with dates. So right now I have a template and I need to add the dates manually. It would be nice if there was a way to automatically add the dates for the whole week. So if today is the 15th, then it should automatically add the 16th. I have looked into moments.js but found no way to add it to a journal template. I imagine some template command for current date +1 or something like that. It don't have to be smart, so if the week is in two months, it can just count up.
It would be really cool if you could add that feature.
Keep up the good work.
Great to hear that you like the journal.
Do you refer to the weekly entry (where you want all dates of the week in the template?
This is tricky. If you open the next week's page ("nw"), we create a weekly page for week 39. The first day would be the 19th (if a week starts on monday, depends if we use it for work only). For "w40", it would be the 26th. I would have to create a new set of variables: "mondayInWeek", "tuesdayInWeek", and so on. Since all variable for now assume the current date, we can't really configure the format. For this, we would need to add modifiers to existing options: ${localDate}
would become ${tuesdayInWeek|localDate}
. But we have to make sure, that we have access to the target week during its resolution.
I thought also about, how could this be done and I think the easiest way is to just add days to the current day. Then the template entry would only work for the current week, but that is enough for me, because I create the week template only for the current week. Because I only need to manipulate the current week, for me it is enough to calculate the upcoming weekdays of the upcoming week. I created a little fork with that functionality: https://github.com/jkellers/vscode-journal/blob/c153c2d5ff0ad3cd4ab7d796f47054664fbdd1e1/src/ext/conf.ts#L799
I also allow the week template to get access to the other variables, to automatically fill the week template with the month and year.
An improvement would be to use the Monday (or Sunday?) of the current week (or any other week) as the base date and add days to this date. Then the day addition would be more consistent and the week entry could be created at any day.
Maybe someone finds this helpful? At least it changes no other behavior.