Skip to content

Commit

Permalink
feat(date): fix bug at print date
Browse files Browse the repository at this point in the history
  • Loading branch information
voyager-seb committed Dec 20, 2024
1 parent ea288ed commit 170221e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/components/activities/Activity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ export default function ActivityComponent({
disableRedirect,
}: Props) {
const formatDate = () => {
const startDateIso = parseISO(startDate)
const startFormattedDate = format(startDateIso, 'MMMM d')
return `${startFormattedDate}, ${timeLapse}`
const date = new Date(startDate) // Interprets the date as UTC
console.log('Parsed Date:', date)

const options: Intl.DateTimeFormatOptions = { month: 'long', day: 'numeric', timeZone: 'UTC' }
const formattedDate = new Intl.DateTimeFormat('en-US', options).format(date)

console.log('Formatted Date:', formattedDate) // Outputs "December 4"
return `${formattedDate}, ${timeLapse}`
}
return (
<Link
Expand All @@ -55,7 +60,7 @@ export default function ActivityComponent({
alignItems="center"
justifyContent="center"
>
<Skeleton variant='rounded' width={140} height={132}/>
<Skeleton variant="rounded" width={140} height={132} />
</Stack>
)}
<Stack gap="5px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function CreateActivityDetailForm({ review, submitHandler }: Prop
resolver: zodResolver(detailFormShema),
mode: 'all',
})

return (
<Card>
<form onSubmit={handleSubmit(submitHandler)}>
Expand Down

0 comments on commit 170221e

Please sign in to comment.