question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

localDatetime timezone discrepancy in iso8601 format

See original GitHub issue

Summary

There is no difference in output between datetime and localDatetime in iso8601 format. I would expect the local timezone to be taken into account for localDateTime.

Replication Steps

Using PostBin as a free API client to test requests using this script:

POST https://postb.in/###?
  &iso8601_datetime={{$datetime iso8601}}
  &iso8601_localDatetime={{$localDatetime iso8601}}
  &rfc1123_datetime={{$datetime rfc1123}}
  &rfc1123_localDatetime={{$localDatetime rfc1123}}

Expected Behavior

In the UK, which is currently observing UTC +1 timezone.

Variable Format Result
$datetime iso8601 2020-07-28T14:30:00.000Z
$localDatetime iso8601 2020-07-28T15:30:00.000+01:00

Actual Behavior

In the UK, which is currently observing UTC +1 timezone.

Variable Format Result
$datetime iso8601 2020-07-28T14:30:00.000Z
$localDatetime iso8601 2020-07-28T14:30:00.000Z

For comparison, this difference is reflected correctly in rfc1123 format.

Variable Format Result
$datetime rfc1123 Tue, 28 Jul 2020 14:30:00 GMT
$localDatetime rfc1123 Tue, 28 Jul 2020 15:30:00 0100

Thanks for your time and effort for this extension and wish you the best with development on #628!

Version

REST Client VS Code OS
v0.24.1 v1.47.3 Windows 10 v2004

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Huachaocommented, Jul 29, 2020

@rdhar nice catch, I have fixed it, and before I publish a new version, you can try the format like following to achieve this {{$localDatetime 'YYYY-MM-DDTHH:mm:ss.SSSZ'}} with a specified format string.

1reaction
Huachaocommented, Jul 29, 2020

@rdhar I will use your suggestion, however, the format YYYY-MM-DDTHH:mm:ss.SSSZ works on my machine

Read more comments on GitHub >

github_iconTop Results From Across the Web

LocalDateTime is not ISO8601 by default - Stack Overflow
If there is no timezone, ISO-8601 assumes "local time." Given that the class is LocalDateTime , that representation makes sense.
Read more >
Working with Dates and Times By Using the ISO 8601 Basic ...
The datetime value is written for this time zone ID by using the E8601DX w. format. The time zone offset is the difference...
Read more >
Convert between LocalDateTime and ZonedDateTime
An instance of LocalDateTime represents a date-time (to nanosecond precision.) without a time-zone in the ISO-8601 calendar system. A ...
Read more >
ISO 8601 Date time Corticon.js serverless mobile
ISO 8601 Formats​​ ISO 8601 represents date and time by starting with the year, followed by the month, the day, the hour, the...
Read more >
ISO 8601 - Wikipedia
The standard does not assign specific meaning to any element of the dates/times represented: the meaning of any element depends on the context...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found