Skip to content

Support Date encoding with sub-millisecond precision #484

Description

@importRyan

Description

Currently, Date is recorded a String with millisecond precision (for most modern devices).

For applications expecting greater precision (e.g., Dates compared to nanosecond precision in existing logic), custom @Column and #bind work, but require dashes of ceremony everywhere.

Avoiding that ceremony is possible if these formatters could output by default (or as an option) with greater precision.

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • I have determined whether this bug is also reproducible in a vanilla GRDB project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

Record Date with same precision as default JSONEncoder/Decoder behavior.

Actual behavior

Rounded millisecond precision

SQLiteData version information

1.6.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions