diff --git a/src/components/SidebarStream.vue b/src/components/SidebarStream.vue
index 11b12ea..849b148 100644
--- a/src/components/SidebarStream.vue
+++ b/src/components/SidebarStream.vue
@@ -10,7 +10,7 @@
{{ dateToText(stream.startTimestamp) }}
- - {{ dateToText(stream.endTimestamp) }}
+ - {{ dateToText(stream.endTimestamp, dayMatches(stream.startTimestamp, stream.endTimestamp)) }}
UA: {{ stream.userAgentHash }}
@@ -45,14 +45,14 @@
};
},
methods: {
- dateToText(unixTimestamp) {
+ dateToText(unixTimestamp, short = false) {
const date = new Date(unixTimestamp);
const options = {
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
};
- if (!this.isToday(date)) {
+ if (!short && !this.isToday(date)) {
options.month = '2-digit';
options.day = '2-digit';
return date.toLocaleDateString('ru-RU', options);
@@ -67,6 +67,15 @@
someDate.getFullYear() === today.getFullYear();
},
+ dayMatches(rFirst, rSecond) {
+ const first = new Date(rFirst);
+ const second = new Date(rSecond);
+
+ return first.getDate() === second.getDate() &&
+ first.getMonth() === second.getMonth() &&
+ first.getFullYear() === second.getFullYear();
+ },
+
dateMatches(rFirst, rSecond) {
const first = new Date(rFirst);
const second = new Date(rSecond);