Skip to content

Support the new BCL DateOnly and TimeOnly structs for Sqlite #24506

Description

@roji

New DateOnly and TimeOnly structs are being introduced to .NET 6 as alternatives to DateTime (dotnet/runtime#49036). This issue tracks supporting them in Sqlite (both ADO.NET and EF Core providers).

Activity

  1. bricelam commented on Mar 26, 2021

    @bricelam
    Contributor

    The DateOnly translations will be the same as the current DateTime translations but using date() instead of datetime().
    The TimeOfDay translations will be the same as the ones listed in issue #18844, but using time() (well actually strftime('%H:%M:%f') to preserve precision) instead of ef_timespan(), and julianday() instead of ef_days().

    Additional translations:

    .NET SQL
    date + time $date || ' ' || $time

    The ADO.NET provider should serialize and deserialize these to TEXT using the hh\:mm\:ss.fff custom format for TimeOfDay and yyyy\-MM\-dd for DateOnly. EF Core literals should use these same formats.

  2. bricelam commented on Mar 26, 2021

    @bricelam
    Contributor

    On a related note, we should look into updating the DateTime, DateTimeOffset, and TimeSpan formats to use fff instead of FFFFFFF.

    This would be a breaking change, but also enables us to get rid of the ugly rtrim calls in the SQL.

  3. added this to the Backlog milestone on Mar 26, 2021
  4. mattjohnsonpint commented on Mar 26, 2021

    @mattjohnsonpint

    Why truncate precision to milliseconds?

  5. bricelam commented on Mar 26, 2021

    @bricelam
    Contributor

    SQLite date and time functions only go to milliseconds. We could allow reading and writing values with higher precision—we do this today for DateTime. But any arithmetic operations on the server will have to truncate. (Unless we add our own UDFs, but IMHO that’s going too far to work around SQLite’s native limitations.)

  6. mattjohnsonpint commented on Apr 15, 2021

    @mattjohnsonpint

    Please note that the final names for these types are DateOnly and TimeOnly and that they are now merged into the main branch for the next version of .NET 6 (preview 4 likely). Please rename the title of this issue accordingly. Thanks.

  7. changed the title [-]Support the new BCL DateOnly and TimeOfDay structs for Sqlite[/-] [+]Support the new BCL DateOnly and TimeOnly structs for Sqlite[/+] on Apr 15, 2021
  8. self-assigned this
    on May 5, 2021
  9. removed this from the Backlog milestone on May 6, 2021
  10. added this to the Backlog milestone on May 7, 2021
  11. 8 remaining items

  12. added 2 commits that reference this issue on Jun 10, 2021
    9dfa171
    13dd7f1
  13. added a commit that references this issue on Jun 15, 2021
    f6b109b
  14. modified the milestones: Backlog, 6.0.0, on Jul 2, 2021
  15. modified the milestones: , 6.0.0 on Nov 8, 2021
  16. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions