What’s going wrong here, the first code works. The second one doesn’t.
I have two dates and I can get the time difference between them
const countToDate = new Date(“2024-02-21”)
const currentDate = new Date()
console.log(Math.ceil((countToDate – currentDate) / 1000))
This works and gives me the seconds between them.
When I create dates and covert the timezone, it fails. Here’s some code
const VenueDate = new Date();
var dateFormat = newIntl.DateTimeFormat(“en-US”, {timeZone:”Europe/Paris”});
const formatted = dateFormat.format(VenueDate);
const startDateTime = new Date(‘2024-02-15 09:00:00.000000’)
const formattedStart = dateFormat.format(startDateTime );
console.log(Math.ceil((formatted – formattedStart ) / 1000))
Any help please