From 2a5763a09012e7852187aa2f7301947e875d8960 Mon Sep 17 00:00:00 2001 From: EliteAsian <29520859+EliteAsian123@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:10:26 -0400 Subject: [PATCH] Show release dates in profile --- src/routes/AppProfile/index.tsx | 21 ++++++++++++++++++++- src/utils/timeFormat.ts | 8 ++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/routes/AppProfile/index.tsx b/src/routes/AppProfile/index.tsx index 96366a6..02a8139 100644 --- a/src/routes/AppProfile/index.tsx +++ b/src/routes/AppProfile/index.tsx @@ -8,7 +8,7 @@ import Box from "@app/components/Box"; import { ApplicationMetadata, SetlistMetadata } from "@app/profiles/types"; import Button, { ButtonColor } from "@app/components/Button"; import MoreDropdown from "./MoreDropdown"; -import { distanceFromToday, millisToDisplayLength } from "@app/utils/timeFormat"; +import { distanceFromToday, localizeDate, millisToDisplayLength } from "@app/utils/timeFormat"; import ProfileIcon from "@app/components/ProfileIcon"; import NewsSection from "@app/components/NewsSection"; import { askOpenUrl } from "@app/utils/safeUrl"; @@ -128,6 +128,25 @@ function AppProfile() { {metadata.description} + +
+ + Release Dates +
+
+ First released: {localizeDate(metadata.initialRelease)} +
+ {activeProfile.profile.version.type === "list" && +
+ {activeProfile.version.tag} released: {localizeDate(activeProfile.version.release)} +
+ } + {activeProfile.profile.version.type !== "list" && +
+ Last updated: {localizeDate(activeProfile.version.release)} +
+ } +
{profile.type === "setlist" &&
diff --git a/src/utils/timeFormat.ts b/src/utils/timeFormat.ts index 676404e..e733e1e 100644 --- a/src/utils/timeFormat.ts +++ b/src/utils/timeFormat.ts @@ -28,3 +28,11 @@ export const isConsideredNewRelease = (releaseDate: string, newestInSetlist: str export const distanceFromToday = (initial: string) => { return intlFormatDistance(new Date(initial), new Date()); }; + +export const localizeDate = (date: string) => { + return new Date(date).toLocaleDateString("en-US", { + year: "numeric", + month: "long", + day: "numeric" + }); +};