Fix date comparison for showing last stream date. Closes https://github.com/owncast/owncast/issues/1223
This commit is contained in:
parent
fcc25bd1e7
commit
6328fc6f90
@ -168,15 +168,17 @@ export function makeLastOnlineString(timestamp) {
|
|||||||
}
|
}
|
||||||
let string = '';
|
let string = '';
|
||||||
const time = new Date(timestamp);
|
const time = new Date(timestamp);
|
||||||
let diffInDays = getDiffInDaysFromNow(time);
|
const comparisonDate = new Date(time).setHours(0,0,0,0);
|
||||||
if (diffInDays > 1) {
|
|
||||||
string = time.toLocaleDateString();
|
if(comparisonDate == new Date().setHours(0,0,0,0)) {
|
||||||
} else {
|
|
||||||
const atTime = time.toLocaleTimeString([], {
|
const atTime = time.toLocaleTimeString([], {
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
});
|
});
|
||||||
string = `Today ${atTime}`;
|
string = `Today ${atTime}`;
|
||||||
|
} else {
|
||||||
|
string = time.toLocaleDateString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return `Last live: ${string}`;
|
return `Last live: ${string}`;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user