Skip to content

Commit

Permalink
Merge pull request #86 from edenia/dev
Browse files Browse the repository at this point in the history
feat(components): changed date format UTC
  • Loading branch information
xavier506 authored Mar 13, 2023
2 parents 6ea4e80 + e90b187 commit 7967cc4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const ElectionScheduleSegment = () => {
turn into an epic watch party that you might not want to miss!
</Text>
<Text type="info">
All times are local ({electionDates.startDateTime.format("z")})
All times are UTC ({electionDates.startDateTime})
</Text>
<Schedule>
<ScheduleEntry timeUtc="12:00">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ export const ParticipationCard = ({ election }: Props) => {
}

const electionDate = electionDates.startDateTime.format("LL");
const electionStartTime = electionDates.startDateTime.format("LT z");
const electionParticipationLimitTime = electionDates.participationTimeLimit.format(
"LLL z"
);
const electionStartTime = `${electionDates.startDateTime.format("LT")} UTC`;
const electionParticipationLimitTime = `${electionDates.participationTimeLimit.format(
"LLL"
)} UTC`;

const isPastElectionParticipationTimeLimit = dayjs().isAfter(
electionDates.participationTimeLimit
Expand Down
5 changes: 4 additions & 1 deletion packages/webapp/src/elections/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import dayjs, { Dayjs } from "dayjs";
import utc from "dayjs/plugin/utc";

dayjs.extend(utc);

import { ActiveStateConfigType, SimpleVoteData } from "./interfaces";
import { getMemberGroupFromIndex } from "./api";
Expand All @@ -13,7 +16,7 @@ export const extractElectionDates = (election: any) => {
throw new Error("Error parsing the Election start date.");
}

const startDateTime = dayjs(rawStartDateTime);
const startDateTime = dayjs(rawStartDateTime).utc();
const participationTimeLimit = startDateTime.subtract(24, "hour");
const estimatedEndDateTime = startDateTime.add(
10, // TODO: estimate and calculate this value properly based on round numbers
Expand Down

0 comments on commit 7967cc4

Please sign in to comment.