/** * Transforms a UTC date to JSON date without datetime. * * @param {date} date Date to format * @return {String} Formatted date string */ export function toJsonDate(date) { date = new Date(date); let day = date.getDate(); let month = date.getMonth() + 1; let year = date.getFullYear(); if (day < 10) day = `0${day}`; if (month < 10) month = `0${month}`; return new Date(`${year}-${month}-${day}`); }