DATAVIEWJS SNIP: Showing my upcoming bills only on paydays

A dataviewjs snip to show the following:

  • When it’s payday (Wednesday of every other week, in my case, happens to be even ISO week numbers), show my upcoming bills for the next 14 days in addition to my normal task list
  • When it’s NOT, just show my normal task list (tasks due within 7 days).
```dataviewjs
if (moment(dv.current().name).format('E') % 2 && moment(dv.current().name).format('d') == 3){
	dv.paragraph(`\`\`\`dataview
TASK
WHERE !completed
WHERE due <= date(this.file.name)+dur(14 days)
SORT due
\`\`\``)
} else {
	dv.paragraph(`\`\`\`dataview
TASK
FROM -#bill
WHERE !completed
WHERE due <= date(this.file.name)+dur(7 days)
SORT due
\`\`\`
`)
}
2 Likes