please help me with this formatting issue here, I'm using Typescript and date-fns and material-ui v.5.0. The selection of a date is correct, and I'm saving on a jason file, that is also correct, but when I open a table, the selected date comes with one day before. I've looked here in this forum, and I found an issue with the timezone, which I couldn't figure out how to fix it. All helps will be very appreciated. See my code below. Look at "dateOperation" please.
// database.json
{
"id": 1,
"type": "test",
"numDocto": "2368",
"dateOperation": "2022-09-15",
"ammountMoviment": 9123.56,
"operationDescription": "Administrativa"
},
// on a table material-ui it shows 14/09/200 - I'm using "pt-BR" european style.
import format from 'date-fns/format';
import ptBR from 'date-fns/locale/pt-BR';
<TableCell>{row.id}</TableCell>
<TableCell align="center">{row.numDocto}</TableCell>
<TableCell align="center">{format(new Date(row.dateOperation),'dd/MM/yyyy', { locale: ptBR })}</TableCell>
<TableCell align="center">{row.type}</TableCell>
<TableCell align="center">{numericFormatter(row.ammountMoviment.toString(),{prefix:'R$', thousandSeparator: '.', decimalSeparator: ',' }) }</TableCell>
<TableCell>{row.operationDescription}</TableCell>