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 | 1x 32x 32x 30x 14x 14x 16x 16x 16x 16x 16x 1x 16x 16x 16x 14x 14x | const ISO_DATE_LENGTH = 10;
function toDateKey(dateOrString) {
if (!dateOrString) return "";
if (typeof dateOrString === "string") {
return dateOrString.substring(0, ISO_DATE_LENGTH);
}
const year = dateOrString.getFullYear();
const month = String(dateOrString.getMonth() + 1).padStart(2, "0");
const day = String(dateOrString.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
}
export function isFutureDate(startingDate, currentDate = new Date()) {
const targetKey = toDateKey(startingDate);
const referenceKey = toDateKey(currentDate);
if (!targetKey || !referenceKey) return false;
return targetKey > referenceKey;
}
|