-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✔️Added Dynamic "Last Updated" Functionality to All Legal Pages ! (#529)
Hey @HimanshuNarware @PSS2134 issue closes #521 I have implemented a dynamic "Last Updated" date feature for the legal pages on the website, including the Terms and Conditions, Privacy Policy, and Licensing pages. The **date format** is set to **"month day, year"** and will update dynamically to reflect the current date. **Additionally, each page has a specific update frequency to ensure the date remains accurate.** **Changes Made :** Added a code to dynamically update the "Last Updated" date for the Terms and Conditions, Privacy Policy, and Licensing pages. The date format is "month day, year" for a professional appearance. Here -    please take a look
- Loading branch information
Showing
3 changed files
with
135 additions
and
3 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 |
---|---|---|
|
@@ -39,9 +39,52 @@ const Footer = styled.div` | |
text-align: center; | ||
`; | ||
|
||
const LastUpdate = styled.div` | ||
margin-bottom: 14px; | ||
font-size: 17px; | ||
color: white; | ||
margin-top: 40px; | ||
margin-bottom: 0px; | ||
`; | ||
|
||
const LastUpdatedDate = styled.span` | ||
font-size: 17px; | ||
color: white; | ||
`; | ||
|
||
const Licensing = () => { | ||
useEffect(() => { | ||
window.scrollTo(0, 0); | ||
|
||
const updateLastUpdatedDate = () => { | ||
const dateElement = document.getElementById("last-updated-date"); | ||
if (!dateElement) { | ||
console.error("Element with ID 'last-updated-date' not found."); | ||
return; | ||
} | ||
const now = new Date(); | ||
const day = now.getDate(); | ||
const monthNames = [ | ||
"January", "February", "March", "April", "May", "June", | ||
"July", "August", "September", "October", "November", "December" | ||
]; | ||
const month = monthNames[now.getMonth()]; // Get the full month name | ||
const year = now.getFullYear(); | ||
dateElement.textContent = `${month} ${day}, ${year}`; | ||
}; | ||
|
||
const updateWeekly = () => { | ||
const now = new Date(); | ||
const dayOfWeek = now.getDay(); // 0 (Sunday) to 6 (Saturday) | ||
const timeUntilNextUpdate = (7 - dayOfWeek) * 24 * 60 * 60 * 1000; // Time until next Sunday | ||
updateLastUpdatedDate(); | ||
setTimeout(updateWeekly, timeUntilNextUpdate); | ||
}; | ||
|
||
updateWeekly(); | ||
|
||
}, []); | ||
|
||
return ( | ||
|
@@ -74,7 +117,14 @@ const Licensing = () => { | |
<Subtitle>Contact Information</Subtitle> | ||
<Footer> | ||
If you have any questions or concerns about this licensing agreement, please contact us at Email: <a href="mailto:[email protected]" style={{ color: 'white' }}>[email protected]</a> | ||
|
||
</Footer> | ||
<Paragraph> | ||
<div className="Lastupdate"> | ||
Last updated: <span id="last-updated-date"></span> | ||
</div> | ||
</Paragraph> | ||
|
||
</Container> | ||
); | ||
}; | ||
|
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
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