What's causing the Error Message when I'm trying to track my habits

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

Hi everyone,

I’m trying to use the ‘Tracker’ plugin in Obsidian to create a line chart that represents my meditation time each day. However, I’m running into some difficulties and was hoping someone could help me out. I currently use Templater to create a template for each day that I want to log the length of time I meditate with the following date format: “D MMM YYYY HH:mm”. The main target data I’m querying with ‘Tracker’ is in the frontmatter, and I’ve set my templates accordingly.

But I keep getting an error that says “No valid date as X value found in notes 9 files are not in the right format.”

Things I have tried

I’ve tried changing the date format in both the Tracker and Templater settings to Obsidian’s default, as well as manually changing the format in some of the logs I’ve made but I haven’t had any luck.

I’ve experienced some issues when using Tracker plugin, and haven’t been able to use that properly for my intents, but I think your issues is more related to choosing a date format which isn’t recognised as a date.

Try using YYYY-MM-DD and/or YYYY-MM-DD[T]HH:mm, which will produce proper ISO 8601 Date formats. This will most likely be better understood by Tracker.

If you’re using Dataview then using proper date formats like these are vital for the queries to work. (Do note however, that if you’re using dateformat() within some of those queries, you might need to change the date format slightly, to achieve the same result)

1 Like

When you say to use these date formats, do you mean in the Obsidian vault settings, the Tracker settings, the Template, something else, or some combination of these?

And does this mean that changing the existing notes’ dates to the format you provided will yield a result on the Tracker query?

Thanks in advance!

Most of them? :smiley:

Your final notes (and fields) needs to use these date format, for the dates to be recognised as dates. So typically you’ll need to update at least the Templater templates, and daily notes templates to use this.

If you’ve already have notes with other format, which you want to use Tracker on, then you need to go into those files and change the textual date to match this format.

So yes, that is the hypothesis. Change the date format, so that Tracker will recognise the dates as actual dates (and not just text strings).

1 Like

I’ve changed the dates for Daily Notes core plugin in Obsidian, the template dates, the default dates for Tracker, and I manually changed the date for each note but it still comes up with the same error

searchType: frontmatter
searchTarget: Meditation Time
folder: + Folder/sub-Folder1/sub-Folder1.1
line:
	title: Meditation Time 
	xAxisLabel: 'Date'
	yAxisLabel: Meditation Length 
	yAxisUnit: min
	lineColor: "#48bd7c"

This is the code block I type out that yields the error, is there anything I’m doing wrong in this? I’m not sure what else to try

searchType: frontmatter, frontmatter
searchTarget: created, Meditation Time
xDataset: 0
folder: Shrine of the Self/Habits/Meditation
line: 
	fillGap: true 
	title: Meditation Times
	xAxisLabel: 'Date'
	yAxisLabel: Meditation Length
	yAxisUnit: min 
	yMin: 0
	lineColor: "#48bd7c"

Ok, so I fixed the issue by adding xDataset: 0, but a new issue has come up.
I missed one day of meditation and didn’t make a note for that day, but I did make up for it by meditating the next day. However, the line graph does not show itself returning up from 0 to the non-zero value on the return day; in fact, it doesn’t continue along the x-axis past the missing day.

image

If this means that you’ve added another Meditation field into your daily notes, then you’ve also changed its values from being a single value, into a list of values. It’s not unlikely that this would break Tracker.

So I’d either move one of those values back into the day you missed it (and make a note potentially related to how you really did it the next day or whatever), or to remove that value and let there be a gap in your graph.

1 Like

I added a fillGap: true field in the code block under line and I believe that was a fix for it. It considered the missed day as having a value of 0 and returned to the value of the following day.

image

So I think I got it working!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.