import { addHours } from "date-fns";

export const timeZoneFix = () => {
    /**
     * Returns iso date based on current timezone.
     */
    const rawDate = new Date(Date.now()).toISOString();
    const offsetMinutes = new Date().getTimezoneOffset(); // in minutes
    const offsetHours =
        -offsetMinutes / 60 >= 0 ? offsetMinutes / 60 : -offsetMinutes / 60;

    return addHours(rawDate, offsetHours).toISOString();
};
