Skip to content

Commit

Permalink
fix: format date and message using intl
Browse files Browse the repository at this point in the history
  • Loading branch information
aliceoq committed Jan 31, 2024
1 parent 1823721 commit b85af78
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,7 @@
"known_issues_sort.label": "Sort by:",
"known_issues_sort.recently_updated": "Recently updated",
"known_issues_sort.newest": "Newest",
"known_issues_result.empty": "No matching results. Try other filters."
"known_issues_result.empty": "No matching results. Try other filters.",
"known_issues_date.created": "Created at",
"known_issues_date.updated": "Updated at"
}
4 changes: 3 additions & 1 deletion src/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,5 +252,7 @@
"known_issues_sort.label": "Ordenar por:",
"known_issues_sort.recently_updated": "Recientemente actualizados",
"known_issues_sort.newest": "Más nuevos",
"known_issues_result.empty": "Ningún resultado coincidente. Pruebe con otros filtros."
"known_issues_result.empty": "Ningún resultado coincidente. Pruebe con otros filtros.",
"known_issues_date.created": "Creado en",
"known_issues_date.updated": "Actualizado en"
}
4 changes: 3 additions & 1 deletion src/messages/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,7 @@
"known_issues_sort.label": "Ordenar por:",
"known_issues_sort.recently_updated": "Recentemente atualizado",
"known_issues_sort.newest": "Mais novos",
"known_issues_result.empty": "Nenhum resultado correspondente. Tente outros filtros."
"known_issues_result.empty": "Nenhum resultado correspondente. Tente outros filtros.",
"known_issues_date.created": "Criado em",
"known_issues_date.updated": "Atualizado em"
}
24 changes: 20 additions & 4 deletions src/pages/known-issues/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,27 @@ const KnownIssuePage: NextPage<Props> = ({
<Tag>{serialized.frontmatter?.kiStatus}</Tag>
</Flex>
<Text sx={styles.dates}>
<em>Criado em </em>
{serialized.frontmatter?.createdAt}
<em>
{intl.formatMessage({
id: 'known_issues_date.created',
})}{' '}
</em>
{serialized.frontmatter?.createdAt
? intl.formatDate(
new Date(serialized.frontmatter?.createdAt)
)
: ''}
{' • '}
<em>Atualizado em </em>
{serialized.frontmatter?.updatedAt}
<em>
{intl.formatMessage({
id: 'known_issues_date.updated',
})}{' '}
</em>
{serialized.frontmatter?.updatedAt
? intl.formatDate(
new Date(serialized.frontmatter?.updatedAt)
)
: ''}
</Text>
</Flex>
</header>
Expand Down

0 comments on commit b85af78

Please sign in to comment.