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

Activity

  1. mbrandonw commented on Jul 13, 2026

    @mbrandonw
    Member

    Hi @importRyan, are you sure that SQLite supports sub-millisecond precision in dates? As far as I can tell it's just milliseconds.

    Since this is not directly an issue with the library, and more of a feature request / discussion, I am going to convert it to a discussion. Let's continue the conversation over there and then we can decide if there is something new that needs to be added to the library.

  2. locked and limited conversation to collaborators on Jul 13, 2026
  3. converted this issue into a discussion #494 on Jul 13, 2026
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions