1.2 KiB
1.2 KiB
tags, 日期, 时间
| tags | 日期 | 时间 | ||
|---|---|---|---|---|
|
<%tp.date.now("YYYY/M/D", 0, tp.file.title,"YYYY-MM-DD") %> | <%tp.date.now("YYYY/M/D HH:mm") %> |
<%*
// 1. 获取当前文件名(即日期,如 2026-04-16)
let title = tp.file.title;
// 2. 解析出年份和月份
let year = title.substring(0, 4);
let month = title.substring(5, 7);
// 3. 设定目标文件夹路径 (Diary/年份/月份)
let folderPath = Diary/${year}/${month};
// 4. 如果文件夹不存在,则递归创建
if (!(await app.vault.adapter.exists(folderPath))) {
await app.vault.createFolder(folderPath);
}
// 5. 将当前文件移动到该文件夹下
// 加上 setTimeout 是为了确保官方插件先完成文件创建,脚本再进行移动
setTimeout(() => {
tp.file.move(${folderPath}/${title});
}, 50);
%>
preface
今天是{{date:YYYY}}年的第{{date:DDD}}天、第{{date:wo}}!
天气:
地点:
summary
完成了什么?遇到了什么问题?解决方案是什么?
上午
- 到地打卡
中午
- 吃饭打卡
下午
- 上课打卡
晚上
- 下课打卡
随想
任何想法、感悟、反思、碎片记录...