diff --git a/common-util/formatDate.js b/common-util/formatDate.js index 7a86c7f9..c9dbc03e 100644 --- a/common-util/formatDate.js +++ b/common-util/formatDate.js @@ -2,7 +2,7 @@ export const formatDate = (date) => { const newDate = new Date(date); const options = { day: '2-digit', - month: 'long', + month: 'short', year: '2-digit', }; const formattedDate = newDate.toLocaleDateString('en-GB', options); diff --git a/common-util/useFetchApi.js b/common-util/useFetchApi.js index 131c5114..0d63abe5 100644 --- a/common-util/useFetchApi.js +++ b/common-util/useFetchApi.js @@ -38,9 +38,11 @@ export const useFetchVideos = (limit = 1000) => { const imageFilename = thumbnailUrl ? `${process.env.NEXT_PUBLIC_API_URL}${thumbnailUrl}` : ''; - + const videoUploadedUrl = get(videoUploaded, 'data[0].attributes.url'); - const video_url = videoUploadedUrl ? `${process.env.NEXT_PUBLIC_API_URL}${videoUploadedUrl}` : ''; + const video_url = videoUploadedUrl + ? `${process.env.NEXT_PUBLIC_API_URL}${videoUploadedUrl}` + : ''; return { id, diff --git a/components/Content/Article.jsx b/components/Content/Article.jsx index a031c428..488429df 100644 --- a/components/Content/Article.jsx +++ b/components/Content/Article.jsx @@ -21,15 +21,19 @@ const Article = ({ article, href, showReadTime, showDate }) => { return data?.attributes?.formats?.large; }, [article]); - const { title, datePublished, readTime } = article.attributes; + const { + title, + datePublished: unFormattedDatePublished, + readTime, + } = article.attributes; const { url, width, height } = image || {}; - const formattedDate = formatDate(datePublished); + const datePublished = formatDate(unFormattedDatePublished); const moreInfo = useMemo(() => { const moreInfoArray = []; - if (showDate && formattedDate) { - moreInfoArray.push(formattedDate); + if (showDate && datePublished) { + moreInfoArray.push(datePublished); } if (showReadTime && readTime) { @@ -37,7 +41,7 @@ const Article = ({ article, href, showReadTime, showDate }) => { } return moreInfoArray.join(' • '); - }, [showDate, formattedDate, showReadTime, readTime]); + }, [showDate, datePublished, showReadTime, readTime]); return ( diff --git a/components/HomepageSection/Media.jsx b/components/HomepageSection/Media.jsx index 68eea768..6a32a3af 100644 --- a/components/HomepageSection/Media.jsx +++ b/components/HomepageSection/Media.jsx @@ -3,10 +3,10 @@ import Articles from 'components/Content/Articles'; import { Videos } from 'components/Content/Videos'; import SectionWrapper from 'components/Layout/SectionWrapper'; -const limit = 3; +const LIMIT = 3; const Media = () => { - const { videos, isLoading } = useFetchVideos(limit); + const { videos, isLoading } = useFetchVideos(LIMIT); return ( { customClasses="px-4 md:px-8 py-12 lg:p-24 border-b" >
- - + +
);