Skip to content

Commit

Permalink
feat : distance 포맷팅하는 유틸함수 구현 (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbyeol3 committed Feb 15, 2021
1 parent 92f60c4 commit f167e62
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ export const getFormattedDate = (dateString: string) => {
const day = date.getDate().toString().padStart(2, '0');
return `${year}.${month}.${day}`;
};

export const getFormattedDistance = (distance: string) => {
const numberDist = +distance;
if (numberDist < 1000) return `${distance}m`;
return `${numberDist / 1000}km`;
};

0 comments on commit f167e62

Please sign in to comment.