Liqp icon indicating copy to clipboard operation
Liqp copied to clipboard

Date filter does not parse ISO-8601 time zone designators correctly

Open SIMULATAN opened this issue 1 year ago • 2 comments

The date filter has a few formats attached. However, a .SSSX format is missing (only ones with a space between the time and time zone), thus ignoring timezones when using ISO-8601 Time zone designators in strings that, rightfully so, lack this space.

In my case, this incorrectly assumes 2024-12-22T18:59:56.925Z to be in local time, even though the Z suffix clearly marks it as UTC. parsed TemporalAccessor has a null zone

There's formats covering this case here, however, since the space delimited formats do not match, it falls back to the .SSS'Z' format, which results in the DateTimeFormatter parsing the Z literally rather than giving it its correct UTC meaning.

I've created a reproducer (in Kotlin) that shows the difference and the proposed .SSSX format here: https://pl.kotl.in/7HuL8wJMU

SIMULATAN avatar Dec 22 '24 19:12 SIMULATAN

Hello! This is known problem. Fix for this under development: https://github.com/bkiers/Liqp/pull/314 Proper work with zones is in roadmap there. Still no ETA, but some next release will have it.

msangel avatar Dec 22 '24 19:12 msangel

@msangel I saw the PR, it's great to hear that this issue will actually be covered by it. Thank you for your work there! Looking forward to getting it merged.

SIMULATAN avatar Dec 22 '24 19:12 SIMULATAN