feat: adapter la date des commentaires à la locale du navigateur
This commit is contained in:
@@ -7,8 +7,6 @@ import Avatar from '@mui/material/Avatar'
|
|||||||
import Typography from '@mui/material/Typography'
|
import Typography from '@mui/material/Typography'
|
||||||
import Chip from '@mui/material/Chip'
|
import Chip from '@mui/material/Chip'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import {format} from 'date-fns'
|
|
||||||
import {fr} from 'date-fns/locale'
|
|
||||||
import {Mastodon} from '@icons-pack/react-simple-icons'
|
import {Mastodon} from '@icons-pack/react-simple-icons'
|
||||||
|
|
||||||
function formatAuteur(commentaire) {
|
function formatAuteur(commentaire) {
|
||||||
@@ -24,7 +22,8 @@ function formatDat(commentaire) {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
return format(new Date(commentaire.datePublication), 'Pp', {locale: fr})
|
return new Intl.DateTimeFormat(undefined, {dateStyle: 'short', timeStyle: 'short'})
|
||||||
|
.format(new Date(commentaire.datePublication))
|
||||||
}
|
}
|
||||||
|
|
||||||
const MENTION_REGEX = /(?:@[\w.-]+){1,2}/g
|
const MENTION_REGEX = /(?:@[\w.-]+){1,2}/g
|
||||||
|
|||||||
Reference in New Issue
Block a user