added
This commit is contained in:
parent
634b44e683
commit
f38d5c7d15
1 changed files with 13 additions and 0 deletions
13
src/services/convertTime.js
Normal file
13
src/services/convertTime.js
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
export function convertIso(isoString) {
|
||||||
|
const date = new Date(isoString);
|
||||||
|
|
||||||
|
// Извлекаем компоненты времени и даты
|
||||||
|
const hours = String(date.getUTCHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getUTCSeconds()).padStart(2, '0');
|
||||||
|
const day = String(date.getUTCDate()).padStart(2, '0');
|
||||||
|
const month = String(date.getUTCMonth() + 1).padStart(2, '0'); // Месяцы в JS — от 0 до 11
|
||||||
|
const year = date.getUTCFullYear();
|
||||||
|
|
||||||
|
return `${hours}:${minutes}:${seconds} ${day}-${month}-${year}`;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue