All files / src/utilities dateMaker.js

100% Statements 5/5
0% Branches 0/1
100% Functions 2/2
100% Lines 5/5

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        8x               78x 78x 78x 78x    
import { MONTHES } from "../CONSTANT/MONTHES.js";
import getTheDateAfterNDays from "./getTheDateAfterNDays.js";
 
export function getCurrentDate() {
    return {
        year: new Date().getFullYear(),
        month: MONTHES[new Date().getMonth()],
        monthIndex: new Date().getMonth()
    }
}
 
export function getDateAfterN(days = 1) {
    const nextDate = getTheDateAfterNDays(days)
    const options = { day: "numeric", month: "long", year: "numeric" };
    const formattedDate = nextDate.toLocaleDateString("en-US", options);
    return formattedDate;
}