Obsidian still appears to not fully support ISO 8601 datetime standard

Continuing the discussion from Properties time type support for ISO 8601 standard:

What I’m trying to do

I updated my templates to include the time zone in valid ISO 8601 format. I’ve tested various valid ISO 8601 formats for file naming and frontmatter. Some of them parse correctly by Obsidian, while others do not.

Obsidian doesn’t seem to support valid ISO 8601 with time zone offset and doesn’t support UTC date and time (UTC±0000).

e.g.:

Note the highlighted T, a false positive error message: “Syntax error. Your frontmatter is invalid."

result:

Note the modified date time is not parsed, a false positive error message: “Type mismatch. Expected Date”

Things I have tried

These are all valid ISO 8601 formats which should be correctly parsed in frontmatter:

{{date:YYYYMMDD}}T{{time:HHmmssZZ}}
{{date:YYYYMMDD}}T{{time:HHmmsszz}}
{{date:YYYYMMDD}}T{{time:HHmmssZ}}
{{date:YYYY-MM-DD}}T{{time:HHmmssZZ}}
{{date:YYYY-MM-DD}}T{{time:HHmmsszz}}
{{date:YYYY-MM-DD}}T{{time:HHmmssZ}}

result (after manually setting the property type to date time):

Note the modified date time is not parsed, a false positive error message: “Type mismatch. Expected Date & time”

Additional references

Well, Obsidian doesn’t necessarily support all “variations” of ISO8601 for the date and date & time type of keys :blush:

Which, for date/time, would be something like:YYYY-MM-DD[T]HH:mm:ss (following MomentJS format)

For the offset, the following format seems to work for me though :blush: : YYYY-MM-DD[T]HH:mm:ssZ

I don’t want to be a time cop … :sweat_smile: however, if it doesn’t support all variations of the standard then it doesn’t actually support the ISO 8601 international standard.

And unless I’m missing something, it definitely doesn’t seem to handle UTC.

More test cases with results:

Also note the syntax error, this false positive error applies to any first occurring ISO 8601 property regardless of T or [T]:

I am going to review this when I get to my desk.
One quick note, your screenshot are not actual dates, they are templates.

The red is is for the template. Because a template is not valid YAML.

Test actual dates.

I can’t test all of these at the moment, but this is the format I use

---
created: "{{date:YYYY-MM-DDTHH:mm}}"
---

and it shows no error (red YAML), with or without quotes, in my main template note.

From your screenshot, it seems like the non-functioning placeholders are the ones where the date part doesn’t follow the format YYYY-MM-DD

For what it’s worth, that was the template I used to test the offset :blush:

---
datetime: {{date:YYYY-MM-DD}}T{{time:HH:mm:ssZ}}
---

But yes, that template would insert the local date/time (not the UTC one)…
At least, that’s what it does for me :innocent:

I think that if you want to insert a UTC date/time + offset in YAML/Properties, you might need a plugin able to call and manipulate moment() directly (Templater and/or other plugin providing “scripting” feature).
Properties might not display the corresponding local date/time though (I mean, it’ll still display the UTC one it’ll find in Source).

Part of the reason for not wanting dashes and colons is to match the filenames, dashes are obviously supported across filesystems, colons aren’t.

Plus these examples are definitely standards compliant.

FWIW, having the filename and frontmatter in the YAML/markdown be the same makes copying and pasting, searching, all much easier without needing another step in the process.


@WhiteNoise thanks, I realize this. It’s the processing of the templates that’s broken. If we don’t change or fret over the property type being Date/Date & time instead of Text, then it’s less of an issue–more of a UX thing. Though test4 above is an oddball with the time processing incorrectly.

@Pch it doesn’t display a syntax error for all the errors. Only the first occurring syntax error.


Obsidian just doesn’t seem to know how to correctly process timezone offsets correctly, including for UTC according to the full ISO 8601 standard:

This sort of thing matters if/when multiple people across different time zones are sharing and working on a vault together.