感谢分享 。
在我的ubuntu里周一获得的日期是上一天的,也就是周日的,可能英文系统里周的第一天是周日的原因,不太懂js,搜了下moment可以配置
window.moment.updateLocale("en", {
week: {
// Set the First day of week to Monday
dow: 1,
},
});
日常都是用dataview操作下面这样的任务
Job A [created:: 2024-12-09] [scheduled:: 2024-12-09] [due:: 2024-12-15] [tid:: T0010cf] [completion:: 2024-12-11]
稍微改一下就可以用了 ,
const weekStart = selectedDate.startOf('isoweek').format("YYYY-MM-DD")
const weekEnd = selectedDate.endOf('isoweek').format("YYYY-MM-DD")
const showTreeOption = showTree ? "show tree" : "";
const queryDayOfWeek = `
TASK
WHERE completion = date("${dateStr}") OR (!completion AND scheduled AND scheduled <= date("${dateStr}"))
`;
const queryWeek = `
TASK
WHERE completion >= date("${weekStart}") AND completion <= date("${weekEnd}")
`;
const query = !showWeekTasks ? queryDayOfWeek : queryWeek;
dv.paragraph("```dataview\n" + query + "\n```");