Use locale to format dates and times (#123)

* Use deployment url in demo description.

Close #131
This commit is contained in:
Luke Vella 2022-04-26 20:10:59 +01:00 committed by GitHub
parent 8263926168
commit 8aec24308e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 1240 additions and 864 deletions

View file

@ -9,6 +9,7 @@ import {
ParsedTimeSlotOption,
} from "utils/date-time-utils";
import { usePreferences } from "./preferences/use-preferences";
import { useRequiredContext } from "./use-required-context";
type VoteType = "yes" | "no";
@ -59,6 +60,7 @@ export const PollContextProvider: React.VoidFunctionComponent<{
});
return res;
}, [participantById, poll.options]);
const { locale } = usePreferences();
const contextValue = React.useMemo<PollContextValue>(() => {
let highScore = 1;
@ -72,6 +74,7 @@ export const PollContextProvider: React.VoidFunctionComponent<{
poll.options,
poll.timeZone,
targetTimeZone,
locale,
);
const getParticipantById = (participantId: string) => {
// TODO (Luke Vella) [2022-04-16]: Build an index instead
@ -106,7 +109,7 @@ export const PollContextProvider: React.VoidFunctionComponent<{
targetTimeZone,
setTargetTimeZone,
};
}, [participantById, participantsByOptionId, poll, targetTimeZone]);
}, [locale, participantById, participantsByOptionId, poll, targetTimeZone]);
return (
<PollContext.Provider value={contextValue}>{children}</PollContext.Provider>
);