Zim

dates in templates

Asked by Morten Nielsen on 2016-05-02

Hi

I have started using templates, and combined with the task list, I now have a need/desire to make due dates in templates.

I use something like the following to create a tasks with a due date of today.
[ ] [d: [% strftime("%Y-%0m-%0d") %]] do stuff

Is there a way to create the date for, say, tomorrow?
or "Tuesday of current week"?

regards
Morten

Question information

Language:
English Edit question
Status:
Answered
For:
Zim Edit question
Assignee:
No assignee Edit question
Last query:
2016-05-02
Last reply:
2016-05-03

Hi Morten,

You could use "strftime" with an argument for another day, but you would
need to hardcode that day in the template. There is no expression language
to code things like "today + x days".

Do you have fixed tasks that are always the same, or are you generating
pages with tasks dynamically? In the later case, you might want to generate
the dates right away rather than using a template function.

REgards,

Jaap

On Mon, May 2, 2016 at 9:27 AM Morten Nielsen <
<email address hidden>> wrote:

> New question #293071 on Zim:
> https://answers.launchpad.net/zim/+question/293071
>
> Hi
>
> I have started using templates, and combined with the task list, I now
> have a need/desire to make due dates in templates.
>
> I use something like the following to create a tasks with a due date of
> today.
> [ ] [d: [% strftime("%Y-%0m-%0d") %]] do stuff
>
> Is there a way to create the date for, say, tomorrow?
> or "Tuesday of current week"?
>
> regards
> Morten
>
> --
> You received this question notification because you are an answer
> contact for Zim.
>

Morten Nielsen (mbn) said : #2

Hi Jaap

I would to have a "template week" (or month)

so weekly, I would create a page, say, ww19 and it would get populated with text and tasks from the template.

Something like:
[] [d:monday] Tasks A
[] [d:tuesday] Tasks B
[] [d:Thursday] Tasks C
[] [d:Sunday] Evaluate

I am inspired by cronjobs, see e.g. https://help.ubuntu.com/community/CronHowto#Crontab_Sections
that syntax is not relevant with zim, but it allows you to specify "first monday of the month", "every other day" and such.

I currently use ctrl+d to insert dates - it works, but it could be a nice feature with easy access to generating tasks due dates.

regard
Morten

Morten Nielsen (mbn) said : #3

Still not thinking crontab style is the way to go, but I found this;
https://pypi.python.org/pypi/croniter/

it converts cron entries to actual dates.

Can you help with this problem?

Provide an answer of your own, or ask Morten Nielsen for more information if necessary.

To post a message you must log in.