22 lines
910 B
JavaScript
22 lines
910 B
JavaScript
"use strict";
|
|
/** Normalizes report Du/Au params to inclusive UTC bounds (aligned with dashboard analytics). */
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.normalizeReportPeriodBounds = normalizeReportPeriodBounds;
|
|
exports.withNormalizedReportPeriod = withNormalizedReportPeriod;
|
|
function normalizeReportPeriodBounds(from, to) {
|
|
const fromRaw = from?.trim();
|
|
const toRaw = to?.trim();
|
|
if (!fromRaw && !toRaw)
|
|
return {};
|
|
return {
|
|
...(fromRaw
|
|
? { from: fromRaw.includes('T') ? fromRaw : `${fromRaw}T00:00:00.000Z` }
|
|
: {}),
|
|
...(toRaw ? { to: toRaw.includes('T') ? toRaw : `${toRaw}T23:59:59.999Z` } : {}),
|
|
};
|
|
}
|
|
function withNormalizedReportPeriod(options) {
|
|
const bounds = normalizeReportPeriodBounds(options.from, options.to);
|
|
return { ...options, ...bounds };
|
|
}
|
|
//# sourceMappingURL=reportPeriodBounds.js.map
|