-
Notifications
You must be signed in to change notification settings - Fork 180
Closed
Labels
Description
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.
});