Skip to content

Commit

Permalink
Experiment overview hotfix (#1949)
Browse files Browse the repository at this point in the history
  • Loading branch information
maamalama authored May 16, 2024
1 parent 19a3099 commit 5f37475
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions web/components/templates/prompts/experiments/scoresTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ const ScoresTable = ({ scores }: ScoresProps) => {
};
};

const formatDate = (date: string) => {
return new Date(date).toLocaleDateString("en-US", {
month: "2-digit",
day: "2-digit",
year: "numeric",
});
};

const getScoreValue = (score: ScoreValue, field: string) => {
if (field === "dateCreated" && typeof score === "string") {
return renderScoreValue(score);
Expand Down Expand Up @@ -74,8 +82,8 @@ const ScoresTable = ({ scores }: ScoresProps) => {
"w-max items-center rounded-lg px-2 py-1 -my-1 text-xs font-medium ring-1 ring-inset"
)}
>
{scores.dataset.scores.dateCreated ===
scores.hypothesis.scores.dateCreated
{formatDate(scores.dataset.scores.dateCreated as string) ===
formatDate(scores.hypothesis.scores.dateCreated as string)
? "same"
: "changed"}
</span>
Expand All @@ -94,7 +102,7 @@ const ScoresTable = ({ scores }: ScoresProps) => {
"w-max items-center rounded-lg px-2 py-1 -my-1 text-xs font-medium ring-1 ring-inset"
)}
>
{`${changeInfo.change > 0 && "+"}${changeInfo.change} (${
{`${changeInfo.change > 0 ? "+" : ""}${changeInfo.change} (${
changeInfo.percentageChange
}%)`}
</span>
Expand Down

0 comments on commit 5f37475

Please sign in to comment.