Форматирование даты #js #date
formateDate = date => {
let dd = date.getDate();
let mm = date.getMonth() + 1;
let yyyy = date.getFullYear();
// day
if (dd < 10) {
dd = '0' + dd;
}
// month
if (mm < 10) {
mm = '0' + mm;
}
// result date
return `${dd}.${mm}.${yyyy}`;
};