Properties: Retain/Save ISO 8601 time zone information

Use case or problem

In this FR (Properties: Parse time offset in iso 8601 dates) support was added to properties to parse ISO 8601 datetime values with a timezone attached, eg 2023-05-25T12:05:16+3000.

Whilst the timezone is parsed correctly now the rendered time is displayed without a timezone offset. For example if my current timezone is UTC+10 but the time in the property value is in UTC, the rendered time is displayed as the UTC time not my local time, making the rendered time 10 hours incorrect.

Proposed solution

It would be great if the rendered property is a datetime and the value has an attached timezone the datetime was converted to local time for the machine. This would let times be stored in UTC or any offset but displayed with the current timezone context for people that shift timezones a lot.

Current workaround (optional)

Most of my datetime fields are rendered using moment().toISOString() as Obsidian parses that well. I work around this currently by using moment().toISOString(true) which renders the resulting datetime string in the local timezone which works fine.

Related feature requests (optional)

I’ll give you a counterpoint with an example:

I have a daily journal note created at 9:32am.

I travel to a different country and go back to look at some of my old daily entries.

I don’t want to see that I created my entry at 5:32pm (or worse, on a different day), I want to see that I created it at 9:32am.

So while I can understand there might be a use case for your scenario, there is also a strong use case for the current method. Having an optional setting would be reasonable.

3 Likes

The title of this feature request is wrong. They are parsed, the information regarding the time zone is not saved but converted to local time.

Yeah thats a fair use case!

The title of this feature request is wrong. They are parsed, the information regarding the time zone is not saved but converted to local time.

Yep thats fair. I unfortunately can’t update the title but maybe “Properties: Retain timezone information” or something else would be better?

Done!

1 Like

Use case or problem

I am using obsidian, while traveling and save datetime in YAML with timezone. The timezone is important, because when difference calculated in dataview it can be difference in several hours without it. The format is full ISO8601:

2023-09-21T10:20:29+04:00

Currently, obsidian only supports till seconds - 2023-09-21T10:20:29

Proposed solution

  1. Support full ISO8601 spec, but it can be several parsing options.
  2. Or provide setting for defining custom format for datetime, like on daily notes core plugin.

Current workaround (optional)