import { ExperimentWithDatapointRunsDto } from "@montelo/browser-client";
import { dayjs } from "~/utils/dayjs";

export const formatExperimentRunDates = (experiment: ExperimentWithDatapointRunsDto, timezone: string | undefined): ExperimentWithDatapointRunsDto => {
  const formattedRuns = experiment.datapointRuns.map((run) => ({
    ...run,
    createdAt: dayjs(run.createdAt).tz(timezone).format("h:mm:ss a"),
  }));
  return {
    ...experiment,
    datapointRuns: formattedRuns,
  };
};
