Skip to content

Commit

Permalink
Show release dates in profile
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteAsian123 committed Aug 25, 2024
1 parent ed688b0 commit 2a5763a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/routes/AppProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -128,6 +128,25 @@ function AppProfile() {
</header>
{metadata.description}
</Box>
<Box>
<header>
<TimeIcon width={14} height={14} />
Release Dates
</header>
<div>
First released: {localizeDate(metadata.initialRelease)}
</div>
{activeProfile.profile.version.type === "list" &&
<div>
{activeProfile.version.tag} released: {localizeDate(activeProfile.version.release)}
</div>
}
{activeProfile.profile.version.type !== "list" &&
<div>
Last updated: {localizeDate(activeProfile.version.release)}
</div>
}
</Box>
{profile.type === "setlist" &&
<Box>
<header>
Expand Down
8 changes: 8 additions & 0 deletions src/utils/timeFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
});
};

0 comments on commit 2a5763a

Please sign in to comment.