8000 Minimal API TimeZoneInfo for Serialization · Issue #1487 · OData/AspNetCoreOData · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Minimal API TimeZoneInfo for Serialization #1487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andy-clymer opened this issue Jun 4, 2025 · 0 comments · May be fixed by #1488
Open

Minimal API TimeZoneInfo for Serialization #1487

andy-clymer opened this issue Jun 4, 2025 · 0 comments · May be fixed by #1488
Assignees

Comments

@andy-clymer
Copy link

I know you can set TimeZoneInfo on the ODataQuerySettings, but this appears to only be used in the ExpressionBinderHelper class and not for serialization.

It'd be nice to add the option to configure TimeZoneInfo for serialization like we have when using OData with controllers. Currently the result from an endpoint always comes back with DateTime displayed using the local time of the server.

Controller Service Configuration:

builder.Services.AddControllers()
    .AddOData(opt =>
    {
        opt.EnableQueryFeatures();
        opt.AddRouteComponents("odata", EdmModelHelper.GetEdmModel());
        opt.TimeZone = TimeZoneInfo.Utc; // Missing from Minimal API Service Configuration
    });

Minimal API Service Configuration Example:

builder.Services.AddOData(q =>
{
    q.EnableAll();
    q.SetCaseInsensitive(true);
    q.SetTimeZoneInfo(TimeZoneInfo.Utc); // Add something like this to be able to set DateTime serialization options.
});
@xuzhg xuzhg self-assigned this Jun 5, 2025
xuzhg added a commit that referenced this issue Jun 12, 2025
minimalApi

Enable ODataActionParameter and ODataUntypedActionParameter binding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0