1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-14 10:36:19 +02:00

show last updated time in more human way.

This commit is contained in:
Kushagra Gour
2016-11-27 09:06:26 +05:30
parent f82e64b369
commit 88e27f0d8f
3 changed files with 11 additions and 1 deletions

View File

@ -359,6 +359,7 @@
margin: 20px 0;
display: block;
border-radius: 4px;
cursor: pointer;
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2);
}
.saved-item-tile:hover {

View File

@ -213,7 +213,7 @@
items.forEach(function (item) {
html += '<div class="js-saved-item-tile saved-item-tile" data-item-id="' + item.id + '">'
+ '<a class="js-saved-item-tile__close-btn saved-item-tile__close-btn">X</a>'
+ '<h3>' + item.title + '</h3><span>Last updated: ' + item.updatedOn + '</span></div>';
+ '<h3>' + item.title + '</h3><span>Last updated: ' + utils.getHumanDate(item.updatedOn) + '</span></div>';
});
} else {
html += 'Nothing saved here.'

View File

@ -88,11 +88,20 @@
}
}
function getHumanDate(timestamp) {
var d = new Date(timestamp);
var retVal = d.getDate() + ' '
+ [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][d.getMonth()] + ' '
+ d.getFullYear();
return retVal;
}
window.utils = {
semverCompare: semverCompare,
generateRandomId: generateRandomId,
onButtonClick: onButtonClick,
addInfiniteLoopProtection: addInfiniteLoopProtection,
getHumanDate: getHumanDate,
log: log
};
})();