Skip to content

Commit

Permalink
✔️Added Dynamic "Last Updated" Functionality to All Legal Pages ! (#529)
Browse files Browse the repository at this point in the history
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 -


![image](https://github.com/user-attachments/assets/9e87ea2e-19df-4425-9702-78eea339bedb)


![image](https://github.com/user-attachments/assets/e1fda929-731e-490c-8fa6-488efba80ce7)


![image](https://github.com/user-attachments/assets/71007482-ee19-454b-b303-2e7551f54838)


please take a look
  • Loading branch information
PSS2134 authored Aug 4, 2024
2 parents d329ff2 + 9cb4a13 commit 924bc75
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 3 deletions.
50 changes: 50 additions & 0 deletions src/Component/Licensing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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>
);
};
Expand Down
47 changes: 45 additions & 2 deletions src/Component/PrivacyPolicy.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,44 @@
import React from 'react';
import React, { useEffect } from 'react';
import styled from 'styled-components';

const PrivacyPolicy = () => {
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 (
<PrivacyWrapper>
<h1>CareerZunction Privacy Policy</h1>

<div className="Lastupdate">
Last updated: <span id="last-updated-date"></span>
</div>
<Section>
<h2>1. Introduction</h2>
<p>Welcome to CareerZunction. We are committed to protecting your privacy and ensuring the security of your personal information. This Privacy Policy outlines how we collect, use, and safeguard your data when you use our platform.</p>
Expand Down Expand Up @@ -118,6 +151,16 @@ const PrivacyWrapper = styled.div`
a:hover {
text-decoration: underline;
}
.Lastupdate {
margin-bottom: 14px;
font-size: 17px;
margin-top: 3px;
}
#last-updated-date {
font-size: 17px;
}
`;

const Section = styled.section`
Expand Down
41 changes: 40 additions & 1 deletion src/Component/Terms.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,43 @@ import styled from 'styled-components';
const TermsAndConditions = () => {
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 (
<TermsWrapper>
<div>
<h1>Terms and Conditions</h1>
<section>
<p>Last updated: July 24, 2024</p>
<div className="Lastupdate">
Last updated: <span id="last-updated-date"></span>
</div>
<p>Welcome to CareerZunction! By using our platform, you agree to comply with and be bound by the following terms and conditions. Please review these terms carefully. If you do not agree to these terms, you should not use our platform.</p>
</section>
<section>
Expand Down Expand Up @@ -89,6 +118,16 @@ const TermsWrapper = styled.div`
a:hover {
text-decoration: underline;
}
.Lastupdate {
margin-bottom: 14px;
font-size: 17px;
margin-top: 3px;
}
#last-updated-date {
font-size: 17px;
}
`;


Expand Down

0 comments on commit 924bc75

Please sign in to comment.