Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call day.js function #30

Closed
Norman-h opened this issue Oct 16, 2023 · 1 comment
Closed

How to call day.js function #30

Norman-h opened this issue Oct 16, 2023 · 1 comment

Comments

@Norman-h
Copy link

I have template like this:

Today Work [[``{ date.from(c.page.name).year() }``-W``{ date.from(c.page.name).week() }``]]

But I need call day.js isoweek. How can I do? Thanks!

@stdword
Copy link
Owner

stdword commented Oct 18, 2023

Hello!

Just like days.js documentation shows:

For your example I've made some changes:

  1. Prefer new syntax style: ``...`` instead of old one: ``{...}``
  2. Used c.page.day to access day.js object related to journal page (it is empty for non-journal), instead of parsing page name with date.from
  3. Changed .week to .isoWeek
  4. Add Variant 2 to access iso week number via .format (see day.js documentation)
Variant 1: Today Work [[``c.page.day.year()``-W``c.page.day.isoWeek()``]]
Variant 2: Today Work [[``c.page.day.format('YYYY-[W]W')``]]

Repository owner locked and limited conversation to collaborators Oct 18, 2023
@stdword stdword converted this issue into discussion #31 Oct 18, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants