diff --git a/sitegin/gitInfo.js b/sitegin/gitInfo.js index 7920c33ad836dca295b89a56aaac9604b7370232..fed2ed2f36fed27e5adb1f60a814137080046c8d 100644 --- a/sitegin/gitInfo.js +++ b/sitegin/gitInfo.js @@ -183,14 +183,18 @@ module.exports = function(obj) { article.metadata.date = {}; if(article.metadata.date.creation === undefined) { - if(mergeCommit === undefined) + if(mergeCommit === undefined) { + console.log('[Warning] Article '+ file +' does not have merge commit.'); article.metadata.date.creation = moment(); - else + } else article.metadata.date.creation = mergeCommit.date; } article.metadata.date.modification = newestCommit.date; - article.metadata.date.modified = (newestCommit !== oldestCommit); + var sameDay = function(a,b) { + return a.getYear()==b.getYear() && a.getMonth() == b.getMonth() && a.getDate() == b.getDate(); + } + article.metadata.date.modified = !sameDay(newestCommit.date, oldestCommit.date); if(article.metadata.author === undefined) article.metadata.author = {} @@ -201,7 +205,7 @@ module.exports = function(obj) { article.commits = commits; } else { - console.log('[Warning] Article '+ file +' is not in git repository or doesn\'t have merge commit'); + console.log('[Warning] Article '+ file +' is not in git repository.'); } }); return obj;