Let's suppose i have a user who submitted a date in database like this: 2023-04-11T14:50||America/Managua. How may i be able to display the date that is coming from database based on each user's timezone. Knowing that i already know its timezone. I am using Javascript and React. This is my submit function.
const handleOnBlur = useCallback(async (e, dirty) => {
e.preventDefault();
if (dirty) {
if (test?.timeZone) {
console.log(test.timeZone);
const dateWithTimeZone = new Date(e.target.value); // Date object with local timezone
const dateWithUTC = dateWithTimeZone.toISOString();
await formValueSubmit(`${dateWithUTC}||${test.timeZone}`);
} else {
console.log('Timezone not available');
}
}
}, [formValueSubmit, test]);