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 = '';
|
||||
const time = new Date(timestamp);
|
||||
let diffInDays = getDiffInDaysFromNow(time);
|
||||
if (diffInDays > 1) {
|
||||
string = time.toLocaleDateString();
|
||||
} else {
|
||||
const comparisonDate = new Date(time).setHours(0,0,0,0);
|
||||
|
||||
if(comparisonDate == new Date().setHours(0,0,0,0)) {
|
||||
const atTime = time.toLocaleTimeString([], {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
string = `Today ${atTime}`;
|
||||
} else {
|
||||
string = time.toLocaleDateString();
|
||||
}
|
||||
|
||||
return `Last live: ${string}`;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user