Obsidian Journal Link 2
< Obsidian Journal Link || >
関連: 1Writer Journal Link 2
2024-10-08
曜日を追加
code:md
<< 2024-10-07 | 2024-10-09 >>
<< 2024-10-01 | 2024-10-15 >>
<< 2024-09-08 | 2024-11-08 >>
<< 2023-10-08 | 2025-10-08 >>
#journal 火
code:js
<%*
moment.locale('ja'); // ロケールを日本語に設定
const fileTitle = tp.file.title; // ファイルのタイトルを取得
const fileDate = moment(fileTitle, "YYYY-MM-DD"); // タイトルから日付を取得
const fileDayOfWeek = fileDate.format('dd'); // 日 ~ 月のいずれかの日本語の曜日を取得
// 日付リンクを生成
const dayBefore = fileDate.clone().subtract(1, 'day').format("YYYY-MM-DD");
const dayAfter = fileDate.clone().add(1, 'day').format("YYYY-MM-DD");
const weekBefore = fileDate.clone().subtract(7, 'days').format("YYYY-MM-DD");
const weekAfter = fileDate.clone().add(7, 'days').format("YYYY-MM-DD");
const monthBefore = fileDate.clone().subtract(1, 'month').format("YYYY-MM-DD");
const monthAfter = fileDate.clone().add(1, 'month').format("YYYY-MM-DD");
const yearBefore = fileDate.clone().subtract(1, 'year').format("YYYY-MM-DD");
const yearAfter = fileDate.clone().add(1, 'year').format("YYYY-MM-DD");
%><< [tR += dayBefore %>] | [tR += dayAfter %>] >>
<< [tR += weekBefore %>] | [tR += weekAfter %>] >>
<< [tR += monthBefore %>] | [tR += monthAfter %>] >>
<< [tR += yearBefore %>] | [tR += yearAfter %>] >>
#journal <% fileDayOfWeek %>