Base solution for your next web application
Open Closed

ClockProvider.UTC changes DateTime parameters from URI to DateTimeKind.Local #7087


User avatar
1
Synciant created

I am using project type Angular+ASP.NET Core v6.5 . I am creating an app which is used in multiple timezones.

I have set Clock.Provider = ClockProviders.Utc in Startup.cs under ConfigureServices(IServiceCollection services)

Whenever, I pass a Date in the URI from the client, it gets converted to DateTimeKind.Local on the server side. But when I pass it through body it remains DateTimeKind.Utc. I want it to remain in DateTimeKind.Utc for both medium.

What am I doing wrong? How can I fix it?


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Binders and Converters ABP automatically normalizes DateTimes received (in an input class) from clients in MVC, Web API and ASP.NET Core applications, based on the current clock provider.

    see: https://aspnetboilerplate.com/Pages/Documents/Timing#binders-and-converters https://github.com/aspnetzero/aspnet-zero-core/issues/1923#issuecomment-439466664