- 前端:反应
- 后端:SpringBoot
- BE 上的日期格式:2011-10-05T14:48:00.000Z
我尝试使用date-fns将正确的格式从 FE 发送到 BE 应用程序,即使遵循文档,BE 也收到 null。
Salvar = async () => {
const {update} = this.state;
const {dtInclusao} = this.state.compra.dtInclusao
var result = parse(
dtInclusao,
"dd/mm/yyyy",
new Date()
)
const response = await api.post('SolicCompra/compra',
{...this.state.compra, dtInclusao: result}, {'Content-type':
'application/json'});
预期格式为dd/MM/yyyy。