mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
consolidate datetime methods
This commit is contained in:
parent
69ae494554
commit
8225003fd5
9 changed files with 29 additions and 70 deletions
|
@ -114,6 +114,16 @@
|
|||
|
||||
function getDisplayTime(date) {
|
||||
|
||||
if ((typeof date).toString().toLowerCase() === 'string') {
|
||||
try {
|
||||
|
||||
date = parseISO8601Date(date, true);
|
||||
|
||||
} catch (err) {
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
||||
var currentLocale = globalize.getCurrentLocale();
|
||||
|
||||
var time = currentLocale && toLocaleTimeStringSupportsLocales ?
|
||||
|
@ -124,7 +134,6 @@
|
|||
|
||||
if (timeLower.indexOf('am') != -1 || timeLower.indexOf('pm') != -1) {
|
||||
|
||||
time = timeLower;
|
||||
var hour = date.getHours() % 12;
|
||||
var suffix = date.getHours() > 11 ? 'pm' : 'am';
|
||||
if (!hour) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue