Templating: week number in templates should use NP API to get NP week, not isoWeek

オープン
#529 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

まだ誰も着手していません。

評価

この issue はまだ評価されていません。

説明

There are convenience functions in templates that get the weekNumber, e.g.

  weekNumber(pivotDate = '') {

@EduardMe has added functionality to get the NP week number instead, since iso may or may not match what you see in your NP interface, depending on what day you pick for the beginning of a week.

For example, here's how I told a user recently to do it:

---
title: Weekly Note Template Tag
---
Using now/today, no matter where you are, this gives you the current weekly note:
[[<%- Calendar.weekYear(new Date()) %>-W<%- Calendar.weekNumber(new Date()) -%>]]
output: 2022-W49

Using week date (this is the best one if you want the weekly note corresponding to a Calendar note which doesn't have to be today):
[[<%- Calendar.weekYear(Editor.note.date) %>-W<%- Calendar.weekNumber(Editor.note.date) -%>]]

Using title (should normally work as above:
[[<%- Calendar.weekYear(new Date(Editor.note.title)) %>-W<%- Calendar.weekNumber(new Date(Editor.note.title)) -%>]]

@jgclark You deal with these kinds of things more than I do. What other things like weekNumber should be fixed/added to the templating date module to give users access to this info?

主要言語
JavaScript
スター
204
フォーク
82
平均マージ
22時間 27分
マージ済み PR(30日)
3

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NotePlan/plugins のほかの issue

NotePlan/plugins の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。