UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

28 lines 613 B
import { formatDate, formatDateRange as formatRange } from "../../date-format/DateFormatUtils.js"; export default function formatDateRange(from, to, locale) { if (!from && !to) { return undefined; } if (from && to && to !== from) { return formatRange({ startDate: from, endDate: to }, { locale, options: { dateStyle: 'long' } }); } const single = from || to; if (single) { return formatDate(single, { locale, options: { dateStyle: 'long' } }); } return undefined; } //# sourceMappingURL=formatDateRange.js.map