The application is based in Portugal whose timezone is UTC+00:00 but now is daylight saving.
Here I received a range of date values from the Datepicker component, which was '01/04/2022 - 01/05/2022' and saved it in a state
const handleCreationDateChange = (dateRange: {
startDate: Date;
endDate: Date;
}) => {
if (dateRange) {
setCreationDate(dateRange);
} else {
setCreationDate(null);
}
};
at this point, the date range object is correct, like the image below
const payload = {
creationDateFrom: dateRange.creationDateFrom,
creationDateTo: dateRange.creationDateTo
}
but the payload object which was sent to the server shows less a day

for a user in Brasil, it shows the correct date but takes a different timezone

I've tried converting to .toIsoString() then converting back to Date but it didn't work
this needs to work for users from different timezones