mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-27 22:30:56 +00:00
24 lines
559 B
JavaScript
24 lines
559 B
JavaScript
'use client';
|
|
import dayjs from 'dayjs';
|
|
import { toDateString } from '../to-date-string/to-date-string.mjs';
|
|
|
|
function getDefaultClampedDate({
|
|
minDate,
|
|
maxDate
|
|
}) {
|
|
const today = dayjs();
|
|
if (!minDate && !maxDate) {
|
|
return toDateString(today);
|
|
}
|
|
if (minDate && dayjs(today).isBefore(minDate)) {
|
|
return toDateString(minDate);
|
|
}
|
|
if (maxDate && dayjs(today).isAfter(maxDate)) {
|
|
return toDateString(maxDate);
|
|
}
|
|
return toDateString(today);
|
|
}
|
|
|
|
export { getDefaultClampedDate };
|
|
//# sourceMappingURL=get-default-clamped-date.mjs.map
|