Obsidian

1. 获取最近七天创建的文件

dateview

table file.tags as "Tags", date(file.ctime) as "Create Time"
from ""
where date(file.ctime) >= date(today) - dur(7 day) and contains(file.frontmatter["dg-publish"], true)
sort file.ctime desc

dateviewjs

const oneWeekAgo = new Date(); 
oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
 
dv.table(["Name", "Tags", "Created"], dv.pages(``)
	.where(p => p.file.ctime > oneWeekAgo && p.file.frontmatter["dg-publish"])
	.sort(p => p.file.ctime, 'desc')
	.map(p => [
		p.file.link,
		p.file.frontmatter['tags'],
		moment(Number(p.file.cday)).format('yyyy-MM-DD')
	])
);

2. 最近七天修改的文件

dateviewjs

const oneWeekAgo = new Date(); 
oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
const currentFilePath = this.app.workspace.getActiveFile().path;
 
dv.table(["Name", "Tags", "Updated"], dv.pages(``)
	.where(p => p.file.mtime > oneWeekAgo 
		&& p.file.frontmatter["dg-publish"] 
		&& p.file.path !== currentFilePath
		&& p.file.ctime <= oneWeekAgo
	)
	.sort(p => p.file.mtime, 'desc')
	.map(p => [
		p.file.link,
		p.file.frontmatter['tags'],
		moment(Number(p.file.mtime)).format('yyyy-MM-DD')
	])
);

dateview

table file.tags as "Tags", date(file.mtime) as "Update Time", file.path
from ""
where date(file.mtime) >= date(today) - dur(7 day) and contains(file.frontmatter["dg-publish"], true) and file.name != "Home"
sort file.ctime desc