I started porting our .Net Framework WebAPIs to .Net Core 5 at work. I noticed that dates being returned in the SPA were off and upon further investigation I saw that after the objects were serialized that the dates were being set as UTC.
I've found that I can get it to work at serialization/deserialization by adding the option as an argument, but it seems like this should be able to be done globally instead of each time the serializer runs.
I've tried adding the following in the WebAPI Startup.cs to change how the dates were being returned but it doesn't seem to work in the startup:
services.AddControllers().AddNewtonsoftJson(o => o.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Unspecified);