1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| //【今日工作】获取
//日报文件名格式(定义成你自己的格式,替换其中的变量) //yyyy = 年份(例如:2023) //m = 自适应位数月份(例如:3、10) //mm = 两位数月份(例如:03、10) //d = 自适应位数日期(例如:3、10) //dd = 两位数日期(例如:03、10) let dailyWorkFileFormat = "日报:yyyy年m月d日"; //日报文件夹目录 let dailyWorkFilePath = "002.工作/工作记录/日报";
//获取当天日报 const fileToday = new Date(dv.current().create); const file = dv.page(dailyWorkFilePath + "/" + formatDailyFileName(fileToday,dailyWorkFileFormat)); if(file != null){ dv.header("3","今日工作") dv.taskList(file.file.tasks,false) } //文件名日期格式化 function formatDailyFileName(date,format){ const dateYear = date.getFullYear(); const dateMonth = date.getMonth() + 1; const dateDate = date.getDate(); return format .replace("yyyy",dateYear) .replace("mm",dateMonth < 10 ? '0' + dateMonth : dateMonth) .replace("m",dateMonth) .replace("dd",dateDate < 10 ? '0' + dateDate : dateDate) .replace("d",dateDate) }
|