Timezones (data.$last.time_zone, timeZone) nach tz-database
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
module.exports = async function(data) {
var localDateStr = new Date().toLocaleString('en-GB', { timeZone: data.$last.time_zone });
const [datePart, timePart] = localDateStr.split(", ");
const [day, month, year] = datePart.split("/").map(Number);
const [hours, minutes, seconds] = timePart.split(":").map(Number);
// Step 2: Create a JavaScript Date object (adjusting month by -1 since it is zero-based)
const localDate = new Date(year, month - 1, day, hours, minutes, seconds);
// Step 3: Convert it to an ISO string (in UTC)
const isoString = localDate.toISOString();
return isoString;
}
import { toZonedTime } from 'date-fns-tz'
const now = new Date()
const date = toZonedTime(now, timeZone) // In June 10am UTC is 6am in New York (-04:00)