diff --git a/html/src/app.js b/html/src/app.js
index 1d7827e7..b1ac3ecf 100644
--- a/html/src/app.js
+++ b/html/src/app.js
@@ -203,39 +203,13 @@ speechSynthesis.getVoices();
arr.push(`${Math.floor(n / 60)}m`);
n %= 60;
}
- if (n || arr.length === 0) {
+ if (arr.length === 0 && n < 60) {
arr.push(`${n}s`);
}
return arr.join(' ');
};
Vue.filter('timeToText', timeToText);
- var timeToTextMin = function (sec) {
- var n = Number(sec);
- if (isNaN(n)) {
- return escapeTag(sec);
- }
- n = Math.floor(n / 1000);
- var arr = [];
- if (n < 0) {
- n = -n;
- }
- if (n >= 86400) {
- arr.push(`${Math.floor(n / 86400)}d`);
- n %= 86400;
- }
- if (n >= 3600) {
- arr.push(`${Math.floor(n / 3600)}h`);
- n %= 3600;
- }
- if (n >= 60) {
- arr.push(`${Math.floor(n / 60)}m`);
- n %= 60;
- }
- return arr.join(' ');
- };
- Vue.filter('timeToTextMin', timeToTextMin);
-
Vue.use(VueLazyload, {
preLoad: 1,
observer: true,
diff --git a/html/src/index.pug b/html/src/index.pug
index 8e8ef4ff..0791d62d 100644
--- a/html/src/index.pug
+++ b/html/src/index.pug
@@ -689,7 +689,7 @@ html
el-table-column(label="Join Count" width="120" prop="$joinCount" sortable)
el-table-column(label="Time Together" width="140" prop="$timeSpent" sortable)
template(v-once #default="scope")
- span(v-if="scope.row.$timeSpent") {{ scope.row.$timeSpent | timeToTextMin }}
+ span(v-if="scope.row.$timeSpent") {{ scope.row.$timeSpent | timeToText }}
el-table-column(label="Last Seen" width="170" prop="$lastSeen" sortable :sort-method="(a, b) => sortAlphabetically(a, b, '$lastSeen')")
el-table-column(label="Last Login" width="170" prop="last_login" sortable :sort-method="(a, b) => sortAlphabetically(a, b, 'last_login')")
el-table-column(label="Date Joined" width="120" prop="date_joined" sortable :sort-method="(a, b) => sortAlphabetically(a, b, 'date_joined')")
@@ -1267,7 +1267,7 @@ html
.detail
span.name Time Together
span.extra(v-if="userDialog.timeSpent === 0") -
- span.extra(v-else) {{ userDialog.timeSpent | timeToTextMin }}
+ span.extra(v-else) {{ userDialog.timeSpent | timeToText }}
.x-friend-item(style="cursor:default")
.detail
span.name(v-if="userDialog.ref.state === 'online' && userDialog.ref.$online_for") Online For