I am trying to store date in DB using the current timezone.
I have used library date-fns-tz
When I convert the date as a string is okay, but when I want to create that string as a Date it is still a problem.
const date = new Date();
const date_string = formatInTimeZone(
date,
"Europe/Rome",
"yyyy-MM-dd HH:mm:ss"
);
console.log(date_string); //2022-04-16 11:46:28 (Right time)
const current_date = new Date(date_string); // 2022-04-16T09:46:28.000Z (Converted to 2h back)