Skip to content

Commit

Permalink
fix event time in registration form preview
Browse files Browse the repository at this point in the history
  • Loading branch information
DovMa committed Oct 20, 2023
1 parent 74a5168 commit 563170a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/forms/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import LoaderComponent from "../other/LoaderComponent";
import Modal from "../other/Modal";
import FishStockingPageTitle from "../other/PageTitle";
import Map from "../other/RegistrationMap";
import {useSearchParams} from "react-router-dom";

const cookies = new Cookies();

Expand Down Expand Up @@ -80,6 +81,8 @@ const RegistrationForm = ({
const user = useAppSelector((state) => state?.user?.userData);
const [showModal, setShowModal] = useState(false);
const users = useAssignedToUsers();
const [searchParams] = useSearchParams();
const { repeat } = Object.fromEntries([...Array.from(searchParams)]);

const callBacks = useFishStockingCallbacks();

Expand Down Expand Up @@ -121,7 +124,9 @@ const RegistrationForm = ({
fishStocking?.assignedTo || fishStocking?.createdBy || null;

const initialValues: any = {
eventTime: null,
eventTime: fishStocking?.eventTime && !repeat
? new Date(fishStocking.eventTime)
: null,
fishOriginCompanyName: fishStocking?.fishOriginCompanyName || "",
assignedTo: fishStocking?.assignedTo || user || undefined,
fishOriginReservoir: fishStocking?.fishOriginReservoir || undefined,
Expand Down

0 comments on commit 563170a

Please sign in to comment.