Set Culture in Blazor WASM And Asp.net core Webapi

Prathamesh Shende 376 Reputation points
2021-08-04T17:24:53.457+00:00

I have project in blazor wasm and asp.net core webapi
I implemented the Culture For currency and dateTime format which in en-IN and en-US . SO When I Set en-IN the api does not work because
date format change to dd/MM/yyyy from MM/dd/YYYY

So how to I solve this problem my api call is like GetDataByDate(DateTime date);
parameter is date

How do I solve this issue?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,194 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,846 Reputation points
    2021-08-04T21:28:49.093+00:00

    you should be passing dates in iso format. the json serializer should handle this. you also need to decide how timezones are handled.

    https://learn.microsoft.com/en-us/dotnet/standard/datetime/system-text-json-support