Skip to content

Commit

Permalink
Upgrading old UI components with new ones
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and root committed Jan 19, 2025
1 parent 206ee47 commit cdc745e
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions src/pages/PublicAppointments/PatientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { toast } from "sonner";
import { z } from "zod";

import { Button } from "@/components/ui/button";
import { DatePicker } from "@/components/ui/date-picker";
import {
Form,
FormControl,
Expand All @@ -21,8 +22,6 @@ import { Label } from "@/components/ui/label";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { Textarea } from "@/components/ui/textarea";

import DateFormField from "@/components/Form/FormFields/DateFormField";

import { usePatientContext } from "@/hooks/usePatientUser";

import { GENDER_TYPES } from "@/common/constants";
Expand Down Expand Up @@ -320,24 +319,11 @@ export function PatientRegistration(props: PatientRegistrationProps) {
<FormItem className="flex flex-col">
<FormLabel required>{t("date_of_birth")}</FormLabel>
<FormControl>
<DateFormField
name="date_of_birth"
value={
<DatePicker
date={
field.value ? new Date(field.value) : undefined
}
onChange={(dateObj: {
name: string;
value: Date;
}) => {
if (dateObj?.value instanceof Date) {
field.onChange(dateObj.value.toISOString());
} else {
field.onChange(null);
}
}}
disableFuture
min={new Date(1900, 0, 1)}
className="-mb-6"
onChange={(date) => field.onChange(date)}
/>
</FormControl>
<FormMessage />
Expand Down

0 comments on commit cdc745e

Please sign in to comment.