e2ed
Version:
E2E testing framework over Playwright
23 lines (22 loc) • 984 B
JavaScript
;
/* eslint-disable @typescript-eslint/no-magic-numbers */
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderDatesInterval = renderDatesInterval;
const sanitizeHtml_1 = require("../sanitizeHtml");
const sanitizeHtml = sanitizeHtml_1.sanitizeHtml;
/**
* Renders the interval between two dates.
* This base client function should not use scope variables (except other base functions).
* @internal
*/
function renderDatesInterval({ endTimeInMs, startTimeInMs }) {
const startDate = new Date(startTimeInMs);
const endDate = new Date(endTimeInMs);
const startDateTime = startDate.toISOString();
const endDateTime = endDate.toISOString();
const date = startDateTime.slice(0, 10);
const startTime = startDateTime.slice(11, 19);
const endTime = endDateTime.slice(11, 19);
return sanitizeHtml `<time datetime="${startDateTime}">${date} ${startTime}</time> –
<time datetime="${endDateTime}">${endTime}</time> UTC`;
}