Skip to content

Commit

Permalink
fix: 버그 수정8
Browse files Browse the repository at this point in the history
  • Loading branch information
abcxj123 committed Jun 11, 2024
1 parent a27c049 commit 46eb7eb
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/utils/dateTimeformat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ export function formatter(date: Date): string {
}

export function formatter2(date: Date) {
const newDate = toLocale(date);
const monthDate =
(date.getMonth() + 1 < 9
? '0' + (date.getMonth() + 1)
: date.getMonth() + 1) +
(newDate.getMonth() + 1 <= 9
? '0' + (newDate.getMonth() + 1)
: newDate.getMonth() + 1) +
'. ' +
(date.getDate() < 9 ? '0' + date.getDate() : date.getDate());
(newDate.getDate() <= 9 ? '0' + newDate.getDate() : newDate.getDate());
const time =
(date.getHours() < 9 ? '0' + date.getHours() : date.getHours()) +
(newDate.getHours() <= 9 ? '0' + newDate.getHours() : newDate.getHours()) +
':' +
(date.getMinutes() < 9 ? '0' + date.getMinutes() : date.getMinutes());
(newDate.getMinutes() <= 9
? '0' + newDate.getMinutes()
: newDate.getMinutes());
console.log(newDate.getHours() + ' ' + '0' + newDate.getMinutes());
return { monthDate, time };
}

Expand Down

0 comments on commit 46eb7eb

Please sign in to comment.