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:
@ -359,6 +359,7 @@
|
|||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
display: block;
|
display: block;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2);
|
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.2);
|
||||||
}
|
}
|
||||||
.saved-item-tile:hover {
|
.saved-item-tile:hover {
|
||||||
|
@ -213,7 +213,7 @@
|
|||||||
items.forEach(function (item) {
|
items.forEach(function (item) {
|
||||||
html += '<div class="js-saved-item-tile saved-item-tile" data-item-id="' + item.id + '">'
|
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>'
|
+ '<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 {
|
} else {
|
||||||
html += 'Nothing saved here.'
|
html += 'Nothing saved here.'
|
||||||
|
@ -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 = {
|
window.utils = {
|
||||||
semverCompare: semverCompare,
|
semverCompare: semverCompare,
|
||||||
generateRandomId: generateRandomId,
|
generateRandomId: generateRandomId,
|
||||||
onButtonClick: onButtonClick,
|
onButtonClick: onButtonClick,
|
||||||
addInfiniteLoopProtection: addInfiniteLoopProtection,
|
addInfiniteLoopProtection: addInfiniteLoopProtection,
|
||||||
|
getHumanDate: getHumanDate,
|
||||||
log: log
|
log: log
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
Reference in New Issue
Block a user