Incorrect dates are displayed in Experience Analytics reports


Description

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.

Solution

To keep consistency in dates, you can use one of the time zones with UTC+12 offset, for example, Asia/Kamchatka time zone:

  1. Open the \sitecore\shell\client\Applications\ExperienceAnalytics\Common\Layouts\Renderings\Shared\ ChartDataConversionService.js file.
  2. Find and replace line 10:
    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" }));