Skip to content

Allow 0-6 decimal places of sub-second precision in DateTime type #2

@obi1kenobi

Description

@obi1kenobi

I'd like to propose allowing more flexibility for decimal seconds on the DateTime type, allowing it to accept or output between 0-6 digits after the decimal point, i.e. down to microsecond precision. Here is my rationale:

  • Different systems and languages by default support different numbers of decimal seconds: OrientDB by default supports only integer seconds (i.e. 0 decimal places), and others like Python support up to 6 decimal places (microseconds).
  • If we prescribe a single, fixed number of decimal places and mandate it for all use cases, no matter what number we pick, we will always make someone unhappy about their use case being unsupported. This may lead to a proliferation of competing DateTime standards, and that's something we would probably all prefer to avoid.
  • Parsing and rounding rules for additional decimal places are reasonably straightforward to implement, and would not add too much complexity to the spec. If a system expects more precision than is provided, we effectively pad the input with zeroes without changing the semantics. If a system is provided more precision than it supports, it can round to the nearest value it supports, which is guaranteed to be no more than half a second away from the input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions