obsidian-tracker
obsidian-tracker copied to clipboard
Current Month
I'm at a loss for how to setup my tracker summary to look at only the current month. Using startDate: -1M appears to go back to the beginning of last month. -0M is invalid.
I can do -5d (as noted below), but this requires me to update the file every day and is not dynamic. How can I see my meditation for the current month?
`` tracker
searchType: frontmatter
searchTarget: goal-ment-meditate
folder: Resources/Daily Notes
startDate: -5d
summary:
template: "Meditation: {{sum()::i}}/{{numDays()::i}}"
Adapt this dataviewJS that is building the tracker code:
```dataviewjs
// Currently Open Note
const noteFile = this.app.workspace.getActiveFile();
let cache = app.metadataCache.getFileCache(noteFile)
const title = cache.frontmatter.title
// ----------------------------
// Here you can define via moment library various dates automaticaly
const start = moment().startOf('quarter');
const end = moment().endOf('quarter');
// ----------------------------
// This is the Mermaid configuration.
const mermaidConf = `tracker
searchType: frontmatter
searchTarget: "Q1"
folder: "5. DIARY/1. Daily"
fixedScale: 1.5
fitPanelWidth: true
startDate: {{start}}
endDate: {{end}}
line:
yAxisLabel: ""
lineColor: "#1ce"
yAxisTickInterval: 1
yAxisTickLabelFormat: i
yMin: 0
yMax: 10
showPoint: false`;
const backticks = "```";
dv.paragraph(
`${backticks}${mermaidConf}
${backticks}
`);
Basically you will build the TRACKER code inside DATAVIEWJS. This will give you flexibility to adjust dates with unlimited options automatically. Every time you will open the note for example you can get beginning of the current week add 6 days extra into it and build the graph for current week. This is just example how you can approach it.
The expression "startDate: {{start}}" has no effect. Whatever is in {{ }}, it is the same output. @dxcore35