I have a class:
public class Filtros{
public DateTime DataInicial { get; set; }
public DateTime DataFinal { get; set; }
//outros campos...
}
I have a C # API that receives the class:
[HttpPost("ObterProvisoes")]
public JsonResult ObterProvisoes(Filtros filtros)
{
//recebe mm/dd/yyyy
}
Then I send the filled Filters object:
var filtros = {
DataInicial: self.DataInicial, // dd/mm/yyyy
DataFinal: self.DataFinal // dd/mm/yyyy
}
$.post("/api/RelatorioFinanceiro/ObterProvisoes", filtros, function () {
}).done(function (response) {
//funcoes
});
When I send the completed object the date is in the format dd / mm / yyyy, but the api receives as mm / dd / yyyy. Is there any way to configure the API or project (asp.net core 1.1) to not change the date? Or inform you that the date format is dd / mm / yyyy in the api?
I do not want to use functions in javascript that convert the date, because I would have to do this every time I had a date in the project, I think it's wrong, I want to solve it all at once.