Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 2x 2x 2x 2x 2x 3x 2x 1x 1x 1x | function isValidDate(value) {
return value instanceof Date && !Number.isNaN(value.getTime());
}
function formatLocalDate(value) {
const year = value.getFullYear();
const month = String(value.getMonth() + 1).padStart(2, "0");
const day = String(value.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
}
export function toDayRange(range) {
if (!Array.isArray(range) || range.length !== 2) {
return { startTime: null, endTime: null };
}
const [start, end] = range;
Iif (!isValidDate(start) || !isValidDate(end)) {
return { startTime: null, endTime: null };
}
return {
startTime: `${formatLocalDate(start)}T00:00:00`,
endTime: `${formatLocalDate(end)}T23:59:59`,
};
}
|