-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add script to fix created dates (#259)
- Loading branch information
1 parent
0cb694f
commit a193293
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
document.addEventListener('DOMContentLoaded', function () { | ||
const dateLabels = document.querySelectorAll( | ||
'.git-revision-date-localized-plugin-date' | ||
); | ||
|
||
// Only make modifications on pages with dates | ||
if (dateLabels.length > 0) { | ||
const lastUpdate = dateLabels[0].innerHTML; | ||
const created = dateLabels[1].innerHTML; | ||
|
||
const lastUpdateDate = new Date(lastUpdate); | ||
const createdDate = new Date(created); | ||
|
||
// If the created date is after the last updated date, | ||
// default to using the last updated date | ||
if (lastUpdateDate < createdDate) { | ||
dateLabels[1].innerHTML = lastUpdate; | ||
} | ||
} | ||
}); |