Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Fix date comparison for showing last stream date. Closes https://github.com/owncast/owncast/issues/1223

Gabe Kangasbe361741a4bb
diff --git a/webroot/js/utils/helpers.js b/webroot/js/utils/helpers.js
index c9b0ccc692..f9fc9c1e56 100644
--- a/webroot/js/utils/helpers.js
+++ b/webroot/js/utils/helpers.js
@@ -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}`;
}