// Function to check if the file (or anything) timestamp was created within the last X minutes
export const is_datetime_recent = function is_datetime_recent({
    datetime,
    minutes,
    log_lvl = 0
}: {
    datetime: string;
    minutes: number;
    log_lvl?: number;
}) {
    if (log_lvl) {
        console.log(
            `*** is_datetime_recent() *** datetime=${datetime} minutes=${minutes}`
        );
    }

    const now: any = new Date();
    const then: any = new Date(datetime);

    const diff = now - then;
    const diff_minutes = Math.floor(diff / 60000);

    if (diff_minutes < minutes) {
        return true;
    } else {
        return false;
    }
};
