Show modified time in local time

This commit is contained in:
Radhi Fadlillah 2018-03-09 08:54:18 +07:00
parent e9d8f3ce12
commit 08f585b493
2 changed files with 18 additions and 7 deletions

File diff suppressed because one or more lines are too long

View file

@ -472,10 +472,8 @@
})
},
bookmarkTime: function (book) {
var time = book.modified,
readTime = "",
finalBookmarkTime = "";
// Define read time
var readTime = "";
if (book.maxReadTime === 0) {
readTime = "";
} else if (book.minReadTime === book.maxReadTime) {
@ -484,7 +482,20 @@
readTime = book.minReadTime + "-" + book.maxReadTime + " min read";
}
finalBookmarkTime = "Updated " + time;
// Convert modified time to local
var time = new Date(book.modified.replace(/-/g, '/') + ' +00');
// Create final time
var month = ("00" + (time.getMonth() + 1)).slice(-2),
date = ("00" + time.getDate()).slice(-2),
hours = ("00" + time.getHours()).slice(-2),
minutes = ("00" + time.getMinutes()).slice(-2),
seconds = ("00" + time.getSeconds()).slice(-2);
var finalBookmarkTime = "Updated " +
time.getFullYear() + "-" + month + "-" + date + " " +
hours + ":" + minutes + ":" + seconds;
if (readTime !== "") finalBookmarkTime += " \u00B7 " + readTime;
return finalBookmarkTime;