Skip to content

Commit

Permalink
update mainnet uptime calculator
Browse files Browse the repository at this point in the history
auto calculate mainnet uptime based on date.
  • Loading branch information
stiemsdev committed Jul 9, 2024
1 parent be75275 commit cb10054
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/Home2023/HybridPower/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ import Split from "../../Split";
import Link from 'next/link';

const HybridPower = () => {
// Function to calculate the difference in days
const calculateDaysSince = (startDate) => {
const start = new Date(startDate);
const now = new Date();
const difference = now - start;
const days = Math.floor(difference / (1000 * 60 * 60 * 24));
return days;
};

// Calculate days since January 19, 2019
const daysSinceLaunch = calculateDaysSince('2019-01-16');

return (
<div id="about">
<section id="home--HybridPower" className="section-2023 pt-60 pb-80">
Expand All @@ -12,7 +24,8 @@ const HybridPower = () => {
<h3 className="subtitle-2023 mt-70 mb-10">Key Metrics</h3>
<div className="metric-boxes mt-40 mb-100">
<div className="metric-boxes__item">
<span>2001</span>
{/* <span>2001</span> */}
<span>{daysSinceLaunch}</span>
<span>Days</span>
<p><strong>Mainnet</strong> Uptime</p>
</div>
Expand Down

0 comments on commit cb10054

Please sign in to comment.