fix(client): 🐛 attempt to fix the one-off date issue

use utc functions from dayjs to correspond to the same date on the server
This commit is contained in:
Amruth Pillai
2022-07-31 02:13:08 -08:00
parent 1c19062c63
commit 5197f954c0
14 changed files with 33 additions and 25 deletions

View File

@ -1,5 +1,6 @@
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import utc from 'dayjs/plugin/utc';
import { useRouter } from 'next/router';
import { useEffect } from 'react';
@ -7,6 +8,7 @@ const DateWrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) =
const { locale } = useRouter();
useEffect(() => {
dayjs.extend(utc);
dayjs.extend(relativeTime);
// Locales