Skip to content

Commit

Permalink
feat(ui-results): add results matrix timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
hdinia committed Feb 23, 2024
1 parent 9be770e commit 29aa349
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import ButtonBack from "../../../../../common/ButtonBack";
import BooleanFE from "../../../../../common/fieldEditors/BooleanFE";
import SelectFE from "../../../../../common/fieldEditors/SelectFE";
import NumberFE from "../../../../../common/fieldEditors/NumberFE";
import moment from "moment";

function ResultDetails() {
const { study } = useOutletContext<{ study: StudyMetadata }>();
Expand Down Expand Up @@ -148,6 +149,16 @@ function ResultDetails() {
},
);

// !NOTE: Workaround to display the date in the correct format, to be replaced by a proper solution.
const dateTimeFromIndex = useMemo(() => {
if (!matrixRes.data) return [];

return matrixRes.data.index.map((dateTime) => {
const parsedDate = moment(dateTime, "MM/DD HH:mm");
return parsedDate.format("ddd D MMM HH:mm");
});
}, [matrixRes.data]);

////////////////////////////////////////////////////////////////
// Event Handlers
////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -368,6 +379,7 @@ function ResultDetails() {
<EditableMatrix
matrix={matrix}
matrixTime={false}
rowNames={dateTimeFromIndex}
stretch={false}
readOnly
/>
Expand Down

0 comments on commit 29aa349

Please sign in to comment.