Skip to content

Support milliseconds with ISO8601DurationSerializer #1231

Open

Description

@solwey-wes

Per https://stackoverflow.com/questions/27058529/iso-8601-duration-with-milliseconds

Use case - EdgeDB outputs ISO 8601 duration values with decimal values for millisecond precision (and doesn't currently have a DSL function to convert to milliseconds since epoch). I can address with them or write something custom but I figure an update to the bundled serializer would be the best solution :)

'PT9.977S'
https://www.edgedb.com/docs/stdlib/datetime#function::std::duration_get

Activity

  1. dave26199 commented on Apr 15, 2023

    @dave26199

    Changing a serializer is a breaking change so it would have to be optional; I suggest you start with something custom and we can later add it here if there is more interest. Thanks :)

  2. solwey-wes commented on Apr 15, 2023

    @solwey-wes
    Author

    @dave26199 Oki will do. I was gonna ask how this would be breaking ‘cause de/serialization of existing values would function exactly as before, but I think I get it…consumers might be implicitly casting to seconds and relying on systems that assume that exact fidelity without decimals/commas. But if so, it seems those systems function in spite of ISO spec…which exists to minimize these compatibility issues. A strange loop 👀.

    Either way I seem to be the only one who has bumped into this so happy to chip away at it and submit a PR so it’s here if more come along :)

  3. dave26199 commented on Apr 16, 2023

    @dave26199

    It's more the serialization side I was worried about, writing a different string can definitely be breaking :) but different deserialization is also a behavior change even if it seems more correct.

    Sounds good, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions