Date labels shown in the Experience Analytics reports might not correspond with real dates due to the incorrect date conversion. By default, the date is returned for the GMT time zone (UTC+0). If the server time zone offset is positive (for example, UTC+8) the converted date (-8 hours) can refer to the previous day.
To keep consistency in dates, you can use one of the time zones with UTC+12 offset, for example, Asia/Kamchatka time zone:
return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());with the following line:
return new Date(date.toLocaleString("en-US", { timeZone: "Asia/Kamchatka" }));