Skip to content

Commit

Permalink
fix date when copying fishStocking
Browse files Browse the repository at this point in the history
  • Loading branch information
DovMa committed Oct 20, 2023
1 parent a6955f6 commit 3d1f743
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/fields/TimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const TimePicker = ({
>
<StyledTextInput
readOnly={true}
showError={false}
showError={true}
label={label}
padding={padding}
value={value ? format(new Date(value), "HH:mm") : ""}
Expand Down
6 changes: 2 additions & 4 deletions src/components/forms/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ const RegistrationForm = ({
const assignedTo =
fishStocking?.assignedTo || fishStocking?.createdBy || null;

const initialValues: FishStocking = {
eventTime: fishStocking?.eventTime
? new Date(fishStocking.eventTime)
: new Date(new Date().setDate(new Date().getDate() + minTime + 1)),
const initialValues: any = {
eventTime: null,
fishOriginCompanyName: fishStocking?.fishOriginCompanyName || "",
assignedTo: fishStocking?.assignedTo || user || undefined,
fishOriginReservoir: fishStocking?.fishOriginReservoir || undefined,
Expand Down
4 changes: 3 additions & 1 deletion src/utils/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const validateMyProfile = Yup.object().shape({

export const validateFishStocking = Yup.object().shape({
location: Yup.object().required(validationTexts.requireText),
assignedTo: Yup.object().required(validationTexts.requireText).nullable(),
eventTime: Yup.date().required(validationTexts.requireText),
assignedTo: Yup.object().required(validationTexts.requireText).nullable(),
phone: Yup.string()
.required(validationTexts.requireText)
.trim()
Expand Down Expand Up @@ -84,6 +85,7 @@ export const validateFishStocking = Yup.object().shape({

export const validateFreelancerFishStocking = Yup.object().shape({
location: Yup.object().required(validationTexts.requireText),
eventTime: Yup.date().required(validationTexts.requireText),
batches: Yup.array().of(
Yup.object().shape({
fishType: Yup.object().required(validationTexts.requireSelect).nullable(),
Expand Down

0 comments on commit 3d1f743

Please sign in to comment.