OData / AspNetCoreOData

ASP.NET Core OData: A server library built upon ODataLib and ASP.NET Core
Other
458 stars 158 forks source link

Fix: Add DateOnly and TimeOnly as Non-standard to standard EDM Primitive Conversions #1353

Open WanjohiSammy opened 1 week ago

WanjohiSammy commented 1 week ago

Issues

This pull request fixes #1327.

Description

This PR included DateOnly and TimeOnly types as non-standard EDM primitive types in the ConvertNonStandardPrimitives method. This is to be able to convert these types to their standard EDM primitive types.

Given the following model:

public class DateOnyTimeOnlyModel
{
    public int Id { get; set; }

    public DateOnly Birthday { get; set; }

    public DateOnly EndDay { get; set; }

    public TimeOnly CreatedTime { get; set; }

    public TimeOnly? EndTime { get; set; }
}

With DateOnly and TimeOnly types added, now supports the following:

Checklist (Uncheck if it is not completed)

Additional work necessary

If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.