/** * Format a given date object to YYYY-MM-DD format. * * @param {Date} date The date object to be formatted. * @returns {string} The formatted date in YYYY-MM-DD format. */ function formatDateToYYYYMMDD(date) { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); const formattedDate = `${year}-${month}-${day}`; return formattedDate; }