blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
6.93k stars 409 forks source link

ISO8601 UTC offset parsed in opposite direction #601

Open CovetingEpiphany2152 opened 2 years ago

CovetingEpiphany2152 commented 2 years ago

Describe the bug There is a bug in ISO8601 UTC offset parsing. The offsets are applied in the opposite direction.

To Reproduce Steps to reproduce the behavior:

  1. Create an inline field for date and time with UTC offset. Set the offset to one that is not your current timezone.
  2. Create a query that shows said date, the date will show up wrongly.

For this example, note that my current timezone's UTC offset is +08:00

Use this inline field:

presale-end-datetime:: 2021-11-02T12:59:00+08:00

The correct time appears in query. However, this offset shows up wrongly. It came up as 1:59pm, which is actually +07:00

presale-end-datetime:: 2021-11-02T12:59:00+09:00

Similarly, this offset comes up as 11:59am, which is actually +09:00

presale-end-datetime:: 2021-11-02T12:59:00+07:00

If applicable, provide the query

```dataview
TABLE presale-end-datetime as presale-end


**Expected behavior**
Expect the correct time to appear. In query.

**Desktop (please complete the following information):**
 - OS: Windows 10
 - Obsidian Version: 0.12.19
 - Dataview Version: 0.4.19
thomascharbonnel commented 2 years ago

Hi, i got the same issue and fixed it there: https://github.com/blacksmithgu/obsidian-dataview/pull/631 One annoyance is that this doesn't show the date/time in the local timezone (the user's timezone), but i'm not sure if i should set the local timezone in expression/parse.ts or elsewhere.

s-blu commented 1 year ago

Hello, sorry to come back to you so late. I currently go through older issues to see which are stale or already solved.

I need to admit that I am confused by all the times and what's correct and what is not, so I am unable to verify it myself - sorry for that! Could you try again if the problem is solved or still persists in a newer version? I hope mentioned #631 fixed it for you, too.