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

support to use dot as timezone offset separator #1413

Closed
wants to merge 1 commit into from

Conversation

biuiko
Copy link

@biuiko biuiko commented Feb 5, 2024

Summary of changes

This PR adds support for using a dot . as a separator for timezone offset, like +9.5 means +09:30. Currently, the library only supports using a colon : as the separator for offset, but some users prefer using a dot for consistency with other time-related formats.

Changes

To achieve this, I have made the following changes:

  • update parsing logic: add function scan::timezone_offset_with_dot_separator to calculate offset
  • add specifier %.z to formatting and parsing

@pitdicker
Copy link
Collaborator

Fractional hours as timezone offset. That is a terrible format. Where did you encounter it?

@pitdicker
Copy link
Collaborator

Thank you @biuiko for contributing to chrono.

ISO 8601 is the prime example of a format that supports fractional values for components of a time or duration. Both are not (yet) supported by chrono. But even that format does not suggest using fractional values for an offset.

In #1083 I already had to make our parsing code for offsets quite a bit more complex to handle real-world cases. (Should yet that ready for review again...) Adding this as another piece of complexity needs a very good use case, such as a common library that generates such strings or some standard.

@biuiko biuiko closed this Feb 6, 2024
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

Successfully merging this pull request may close these issues.

None yet

2 participants