Skip to content

Commit

Permalink
feat: add formatDate
Browse files Browse the repository at this point in the history
  • Loading branch information
yumincho committed Mar 20, 2024
1 parent 315bfba commit 913b895
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/web/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ export const formatTime = (isoString: string) => {

return `${ampm} ${displayHours}:${displayMinutes}`;
};

export const formatDate = (isoString: string) => {
const time = new Date(isoString);

const year = time.getFullYear();
const month = time.getMonth() + 1;
const date = time.getDate();
const day = ["일", "월", "화", "수", "목", "금", "토"][time.getDay()];

return `${year}${month}${date}일 (${day})`;
};

0 comments on commit 913b895

Please sign in to comment.