obsidian-tracker icon indicating copy to clipboard operation
obsidian-tracker copied to clipboard

[Feature request] Allow parsing of ISO-8601 datetime format in frontmatter

Open kohane27 opened this issue 2 years ago • 0 comments

Hello there! Thank you for creating such an awesome Obsidian plugin. It makes Quantified Self so much easier. However, I'm having the following issue.

I'm trying to track sleep, wake_up and the calculated sleep_hours. Example of frontmatter from daily note:

---
created: 2022-05-23
sleep: 2022-05-21T23:00:00+00:00
wake_up: 2022-05-22T07:00:00+00:00
sleep_hours: 8
---

Minimal example that doesn't work:

```tracker
searchType: frontmatter
searchTarget: wake_up
datasetName: Wake Up
line:
    title: "Sleep Habits"
    yAxisLabel: "Time (24h)"
```

I get the No valid Y value found in notes error. The reason for ISO-8601 date format is because I reply on = (this.wake_up - this.sleep).hours inline dataviewjs to calculate sleep_hours.

The following format with just the time works:

sleep: 23:00
wake_up: 07:00

But it means that my data won't comply with ISO-8601 (hence not very portable). Most importantly, without the date value, the calculated value is sometimes wrong.

I looked into the doc and the only mentioned of iso is ISO-8601 Date Format, but it's about setting the startDate and endDate in iso-8601.

Is it possible to add more input parameters, e.g., yAxisDateFormat and yAxisDisplayedFormat like the following:

```tracker
searchType: frontmatter
searchTarget: wake_up
datasetName: Wake Up
line:
    title: "Sleep Habits"
    yAxisLabel: "Time (24h)"
    yAxisDateFormat: iso-8601
    yAxisDisplayedFormat: "HH:mm:ss"
```

So that the Y-axis contains only the time but not the whole iso-8601?

Any help is much appreciated. Thank you again!

kohane27 avatar May 23 '22 06:05 kohane27