Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strftime: Offsets with colons #5253

Open
philrz opened this issue Aug 26, 2024 · 0 comments
Open

strftime: Offsets with colons #5253

philrz opened this issue Aug 26, 2024 · 0 comments

Comments

@philrz
Copy link
Contributor

philrz commented Aug 26, 2024

tl;dr

Zed's strftime function currently can only print offsets without colons (e.g., 2024-08-14T12:12:51-0700). However, RFC 3339 (which ZSON time literals are based on) only support offsets with colons (e.g., 2024-08-14T12:12:51-07:00). So to be consistent we may want to add support for this.

Details

At the time this issue is being opened, Zed is at commit 4360baf.

#5221 has a whole lot more context on this topic. A high-level summary:

  • The https://github.com/lestrrat-go/strftime library we use for Zed's strftime doesn't seem in a hurry to get too far beyond the POSIX minimum, and that only provides a %z directive that gives offsets without colons.
  • Things like GNU Date and the https://github.com/samsonjs/strftime library we now use in Zui support a %:z directive that adds the colon.
  • As a user, it feels odd to me that Zed's own strftime can't construct a valid ZSON time literal. This is not a crisis, however, because Zed's cast to time type from a string timestamp parses the offset ok with or without the colon.

If we take up this work, we might want to try to upstream it to https://github.com/lestrrat-go/strftime. Looking over their prior issues/PRs it seems they have a mixed record of accepting extensions to the base set. But I do feel RFC 3339 makes for a compelling argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant