Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(footer): remove auto timestamp #1444

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions src/gatsby-theme-carbon/components/Footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const CustomFooter = () => {
.
</p>
<p>
Last updated <span id="last-modified"> </span>
Last updated Feb 01, 2022
<br />
Copyright &copy; 2022 IBM
</p>
Expand Down Expand Up @@ -58,27 +58,6 @@ const CustomFooter = () => {
};

useEffect(() => {
// Auto populate the last modified date
const lastModifiedTime = new Date(document.lastModified);
const dateOptions = { month: 'long' };

const month = new Intl.DateTimeFormat('en-US', dateOptions).format(
lastModifiedTime
);
const day = lastModifiedTime.getUTCDate();
const year = lastModifiedTime.getUTCFullYear();
const hours = lastModifiedTime.getHours();
const minutes =
lastModifiedTime.getMinutes() < 10
? `0${lastModifiedTime.getMinutes()}`
: lastModifiedTime.getMinutes();
const ampm = hours >= 12 ? 'PM' : 'AM';

const div = document.getElementById('last-modified');
if (div) {
div.innerHTML = `${month} ${day}, ${year} at ${hours}:${minutes}${ampm}`;
}

// Appends the data-autoid for the last footer item
// eslint-disable-next-line no-undef
const footer = document.getElementsByTagName('footer');
Expand Down