2026-05-18 17:33:45 +03:00

10 lines
538 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// TODO: есть уже похожая функция в utils, может модернизировать ее
export const formatToDDMMYYYY = (dateString) => {
const date = new Date(dateString);
const day = String(date.getDate()).padStart(2, '0');
const month = String(date.getMonth() + 1).padStart(2, '0');
//у нас год только текущий и следующий, поэтому 1970 считается текущим
const year = date.getFullYear() == 1970 ? 'y' : 'y+1';
return `${day}.${month}.${year}`;
};