Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added date-field reusable component; Migrated old DateFormFields to new UI components #10049

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix dateValue formatting in render
  • Loading branch information
root authored and root committed Jan 20, 2025
commit 18776b14c1771a9dffa9a0fa34962e868ef8d2d4
16 changes: 7 additions & 9 deletions src/pages/PublicAppointments/PatientRegistration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { toast } from "sonner";
import { z } from "zod";

import { Button } from "@/components/ui/button";
import { DatePicker } from "@/components/ui/date-picker";
import DateField from "@/components/ui/datefield";
import {
Form,
FormControl,
Expand Down Expand Up @@ -319,15 +319,13 @@ export function PatientRegistration(props: PatientRegistrationProps) {
<FormItem className="flex flex-col">
<FormLabel required>{t("date_of_birth")}</FormLabel>
<FormControl>
<DatePicker
date={
field.value ? new Date(field.value) : undefined
}
onChange={(date) => field.onChange(date)}
disabled={(date) =>
date <= new Date("1900-01-01") ||
date >= new Date()
<DateField
value={
typeof field.value === "string"
? field.value
: field.value?.toISOString().split("T")[0]
}
onChange={field.onChange}
/>
</FormControl>
<FormMessage />
Expand Down
Loading