Skip to content

How to call day.js function to get ISO week number? #31

Answered by stdword
Norman-h asked this question in Q&A
Discussion options

You must be logged in to vote

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)
  5. Variant 2 also shows a way to get off the clickable ref inside template
Variant 1: Today Work [[``c.page.day.year()``-W``c.page.day.isoWeek()``]]
Variant 2: Today Work ``[c.page.day.format('YYYY-[W]W')]``

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by stdword
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@stdword
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #30 on October 18, 2023 16:25.