-
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.
- Loading branch information
1 parent
9861adc
commit 7d154f2
Showing
3 changed files
with
12 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export default function getFormattedTime(timestamp) { | ||
const date = new Date(timestamp * 1000) | ||
const hours = date.getHours() | ||
const minutes = '0' + date.getMinutes() | ||
export default function getFormattedTime(timestamp, options) { | ||
const { format: formatTime } = new Intl.DateTimeFormat('en', { | ||
hour: options.hourOptions, | ||
minute: options.minuteOptions, | ||
hour12: false, | ||
}) | ||
|
||
return hours + ':' + minutes.substr(-2) | ||
return formatTime(timestamp) | ||
} |