The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix: Display year for releases from previous years on website (#13276) (#13291)
vishwas babar00f0c6847881
diff --git a/packages/twenty-website/src/app/(public)/releases/page.tsx b/packages/twenty-website/src/app/(public)/releases/page.tsxindex 804afba2dfa..7f5740eba6a 100644--- a/packages/twenty-website/src/app/(public)/releases/page.tsx+++ b/packages/twenty-website/src/app/(public)/releases/page.tsx@@ -32,7 +32,7 @@ const Home = async () => {const visibleReleasesNotes = getVisibleReleases(releaseNotes,- latestGithubRelease.tagName,+ latestGithubRelease?.tagName || 'v0.0.0',);const mdxReleasesContent = await getMdxReleasesContent(releaseNotes);diff --git a/packages/twenty-website/src/app/_components/releases/Release.tsx b/packages/twenty-website/src/app/_components/releases/Release.tsxindex 9c901d1df58..b049546e9a8 100644--- a/packages/twenty-website/src/app/_components/releases/Release.tsx+++ b/packages/twenty-website/src/app/_components/releases/Release.tsx@@ -8,6 +8,7 @@ import { ReleaseNote } from '@/app/(public)/releases/api/route';import { ArticleContent } from '@/app/_components/ui/layout/articles/ArticleContent';import MotionContainer from '@/app/_components/ui/layout/LoaderAnimation';import { Theme } from '@/app/_components/ui/theme/theme';+import { formatGithubPublishedAtDisplayDate } from '@/shared-utils/formatDisplayDate';const StyledContainer = styled.div`width: 810px;@@ -24,6 +25,7 @@ const StyledContainer = styled.div`const StyledVersion = styled.div`text-align: center;width: 148px;+ min-width: 148px;font-size: 24px;display: flex;flex-flow: column;@@ -33,6 +35,7 @@ const StyledVersion = styled.div`@media (max-width: 810px) {width: 100%;+ min-width: unset;font-size: 20px;flex-flow: row;justify-content: space-between;@@ -50,6 +53,8 @@ const StyledDate = styled.span`color: ${Theme.text.color.secondary};font-weight: 400;font-size: ${Theme.font.size.sm};+ white-space: nowrap;+ margin-top: 4px;`;const gabarito = Gabarito({@@ -75,9 +80,7 @@ export const Release = ({<StyledVersion><StyledRelease>{release.release}</StyledRelease><StyledDate>- {githubPublishedAt.endsWith(new Date().getFullYear().toString())- ? githubPublishedAt.slice(0, -5)- : githubPublishedAt}+ {formatGithubPublishedAtDisplayDate(githubPublishedAt)}</StyledDate></StyledVersion><ArticleContent>{mdxReleaseContent}</ArticleContent>diff --git a/packages/twenty-website/src/shared-utils/formatDisplayDate.ts b/packages/twenty-website/src/shared-utils/formatDisplayDate.tsnew file mode 100644index 00000000000..420a951b3bb--- /dev/null+++ b/packages/twenty-website/src/shared-utils/formatDisplayDate.ts@@ -0,0 +1,14 @@+export const formatGithubPublishedAtDisplayDate = (+ dateString: string,+): string => {+ const date = new Date(dateString);+ const currentYear = new Date().getFullYear();++ const formatter = new Intl.DateTimeFormat('en-US', {+ month: 'short',+ day: 'numeric',+ ...(date.getFullYear() !== currentYear && { year: 'numeric' }),+ });++ return formatter.format(date);+};