Skip to content

Add assertions for net6.0 DateOnly/TimeOnly #1754

@jnyrup

Description

@jnyrup

Description

.NET 6 introduced two new interesting time structures, DateOnly and TimeOnly, see this PR.

Currently one can workaround the missing APIs in Fluent Assertions by converting DateOnly to DateTime and TimeOnly to TimeSpan.

new DateOnly().ToDateTime(TimeOnly.MinValue).Should();
new TimeOnly().ToTimeSpan().Should();

It would be nice if we had native APIs for asserting on DateOnly and TimeOnly.
I believe most assertions can simply be copied from the [Nullable]DateTimeAssertions and [Nullable]SimpleTimeSpanAssertions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions