forked from b00tc4mp/isdi-bootcamp-202405
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement visual changes in app b00tc4mp#84
- Loading branch information
Showing
11 changed files
with
123 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function formatTime(date) { | ||
const seconds = Math.floor((Date.now() - date.getTime()) / 1000) | ||
|
||
if (seconds < 60) { | ||
return seconds + ' second' + (seconds === 1 ? '' : 's') | ||
} | ||
|
||
const minutes = Math.round(seconds / 60) | ||
|
||
if (minutes < 60) { | ||
return minutes + ' minute' + (minutes === 1 ? '' : 's') | ||
} | ||
|
||
const hours = Math.round(minutes / 60) | ||
|
||
if (hours < 24) { | ||
return hours + ' hour' + (hours === 1 ? '' : 's') | ||
} | ||
|
||
const days = Math.round(hours / 24) | ||
|
||
if (days < 7) { | ||
return days + ' day' + (days === 1 ? '' : 's') | ||
} | ||
|
||
const weeks = Math.round(days / 7) | ||
|
||
if (weeks < 4) { | ||
return weeks + ' week' + (weeks === 1 ? '' : 's') | ||
} | ||
|
||
const months = Math.round(weeks / 7) | ||
|
||
if (months < 12) { | ||
return months + ' month' + (months === 1 ? '' : 's') | ||
} | ||
|
||
const years = Math.round(months / 7) | ||
|
||
return years + ' year' + (years === 1 ? '' : 's') | ||
|
||
} | ||
|
||
export default formatTime |