Files
no-copy-frontend/src/app/lib/formatDate.ts
T

17 lines
605 B
TypeScript
Raw Normal View History

2026-02-21 15:07:37 +07:00
// Форматирование даты из timestamp
export const formatDate = (timestamp: number | string) => {
const date = new Date(timestamp);
const day = date.getDate().toString().padStart(2, '0');
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const year = date.getFullYear();
return `${day}.${month}.${year}`;
};
export const formatDateTime = (timestamp: number | string) => {
const date = new Date(timestamp);
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
return `${hours}:${minutes}`;
};