API Restful java gets wrong JSON POST date

0

I have a Rest API in java that is getting the wrong date. JavaScript sends the following JSON:

{
"pessdtcad": "2018-02-24",
"dataNascimento": "1984-05-18",
"nome": "GUSTAVO DE FREITAS",
"sexo": "M",
}

And the backend shows the dates one day less.

For example, when adding JSON above this is the information I get in the back:

GUSTAVO DE FREITAS;
Thu May 17 21:00:00 BRT 1984;
Fri Feb 23 21:00:00 BRT 2018

Has anyone ever gone through this and could you help me?

    
asked by anonymous 27.02.2018 / 16:28

1 answer

0

Your JSON does not have timezone or culture set, so when it arrives on your backend it assumes it is in a standard timezone and fits into your area. I suggest specifying timezone to solve your problem.

@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT-3")

You may notice a similar problem being resolved here.

    
27.02.2018 / 17:01