Skip to content

Commit

Permalink
Bug Fix: Election date for countdown (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Megha-Dev-19 authored Aug 29, 2023
1 parent 7ad5942 commit ced8e94
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/components/common/ProgressTracker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getConfig } from '../../utils/config';
import { formatNumberWithComma } from '../../utils/utilityFunctions';
import { useSelector } from 'react-redux';
import {
ElectionsStartTime,
IAHShutDownEndTime,
IAHShutDownStartTime,
Links,
Expand Down Expand Up @@ -92,7 +93,7 @@ const ProgressTracker = () => {

useEffect(() => {
const isElectionStarted = moment().isSameOrAfter(
IAHShutDownStartTime.clone().tz(userTimezone)
ElectionsStartTime.clone().tz(userTimezone)
);
setElectionStarted(isElectionStarted);
updateCountdown();
Expand Down Expand Up @@ -167,23 +168,26 @@ const ProgressTracker = () => {
)}
</div>
</>
<div
style={{ backgroundColor: '#F29BC0' }}
className="p-2 text-white font-semibold flex gap-x-8 justify-center items-center"
>
<p>
{electionStarted
? 'TIME REMAINING IN CURRENT ELECTION'
: 'VOTER REGISTRATION END'}
S
</p>
<p className="text-lg flex gap-x-3 items-end">
<NumberContainer number={countdown.days} text="D" />
<NumberContainer number={countdown.hours} text="H" />
<NumberContainer number={countdown.minutes} text="M" />
<NumberContainer number={countdown.seconds} text="S" />
</p>
</div>
{/* to not show any countdown from 1 sept to 7 sept */}
{!electionStarted && countdown.days === 0 ? null : (
<div
style={{ backgroundColor: '#F29BC0' }}
className="p-2 text-white font-semibold flex gap-x-8 justify-center items-center"
>
<p>
{electionStarted
? 'TIME REMAINING IN CURRENT ELECTION'
: 'VOTER REGISTRATION END'}
S
</p>
<p className="text-lg flex gap-x-3 items-end">
<NumberContainer number={countdown.days} text="D" />
<NumberContainer number={countdown.hours} text="H" />
<NumberContainer number={countdown.minutes} text="M" />
<NumberContainer number={countdown.seconds} text="S" />
</p>
</div>
)}
</div>
);
} else return null;
Expand Down
1 change: 1 addition & 0 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,4 @@ export const AccountFlag = {

export const IAHShutDownStartTime = moment.unix(1693612799); // September 1 @ 23:59:59
export const IAHShutDownEndTime = moment.unix(1695427199); // September 22 @ 23:59:59
export const ElectionsStartTime = moment.unix(1694131200); // September 8 @ 00:00:00

0 comments on commit ced8e94

Please sign in to comment.