diff --git a/packages/web/components/templates/homeFeed/EditItemModals.tsx b/packages/web/components/templates/homeFeed/EditItemModals.tsx index 2920a7944..890c92ca5 100644 --- a/packages/web/components/templates/homeFeed/EditItemModals.tsx +++ b/packages/web/components/templates/homeFeed/EditItemModals.tsx @@ -1,9 +1,9 @@ import { - ModalRoot, ModalContent, ModalOverlay, + ModalRoot, } from '../../elements/ModalPrimitives' -import { VStack, HStack, Box, SpanBox } from '../../elements/LayoutPrimitives' +import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives' import { Button } from '../../elements/Button' import { StyledText } from '../../elements/StyledText' @@ -237,7 +237,7 @@ function EditItemModal(props: EditItemModalProps): JSX.Element { SAVED AT: { const dateStr = event.target.value @@ -255,7 +255,7 @@ function EditItemModal(props: EditItemModalProps): JSX.Element { type="datetime-local" value={ props.publishedAt - ? props.publishedAt.format('YYYY-MM-DDThh:mm') + ? props.publishedAt.format('YYYY-MM-DDTHH:mm') : undefined } placeholder="Edit Published Date" diff --git a/packages/web/lib/dateFormatting.ts b/packages/web/lib/dateFormatting.ts index 587db2e88..0ac9bff52 100644 --- a/packages/web/lib/dateFormatting.ts +++ b/packages/web/lib/dateFormatting.ts @@ -1,15 +1,19 @@ //https://github.com/you-dont-need/You-Dont-Need-Momentjs const locale = Intl.DateTimeFormat().resolvedOptions().locale || 'en-US' +// get the user's time zone +const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone export function formattedLongDate(rawDate: string): string { return new Intl.DateTimeFormat(locale, { dateStyle: 'long', + timeZone, }).format(new Date(rawDate)) } export function formattedShortDate(rawDate: string): string { return new Intl.DateTimeFormat(locale, { dateStyle: 'short', + timeZone, }).format(new Date(rawDate)) }