Skip to content

Commit

Permalink
date format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanptm committed Sep 22, 2024
1 parent 11ee763 commit 763a907
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 25 deletions.
9 changes: 1 addition & 8 deletions client/app/(patient)/appointments/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const Page = () => {
<CardContent className="space-y-4">
<div className="flex items-center space-x-2">
<Calendar className="w-5 h-5" />
<span>{format(new Date(appointment.appointmentDate!), "PPP")}</span>
<span>{format(new Date(appointment.appointmentDate!), "PPPP")}</span>
</div>
<div className="flex items-center space-x-2">
<Clock className="w-5 h-5" />
Expand Down Expand Up @@ -215,13 +215,6 @@ const Page = () => {
<CardTitle>Slot Information</CardTitle>
</CardHeader>
<CardContent className="grid grid-cols-1 md:grid-cols-3 gap-4">
<div className="flex items-center space-x-2">
<Calendar className="w-5 h-5" />
<div>
<p className="font-semibold">Day</p>
<p className="capitalize">{appointment.slot?.day}</p>
</div>
</div>
<div className="flex items-center space-x-2">
<Clock className="w-5 h-5" />
<div>
Expand Down
13 changes: 5 additions & 8 deletions client/app/(patient)/new-appointment/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ import { Skeleton } from "@/components/ui/skeleton";
import Image from "next/image";
import Link from "next/link";
import { useParams } from "next/navigation";
import { format } from "date-fns";
import { XCircle } from "lucide-react";
import { ButtonV2 } from "@/components/common/ButtonV2";
import { format } from 'date-fns'


export default function AppointmentSuccessPage() {
const paymentId = useParams().id as string;
const { data: appointment, isLoading, isError, error } = useGetAppointmentSuccessPageDetails(paymentId);

const formatDate = (dateString: string) => {
return format(new Date(dateString), "MMMM d, yyyy");
};
const { data: appointment, isLoading, error } = useGetAppointmentSuccessPageDetails(paymentId);

return (
<div className="min-h-screen bg-background flex flex-col items-center justify-center p-4">
Expand Down Expand Up @@ -89,7 +86,7 @@ export default function AppointmentSuccessPage() {
<div>
<p className="font-medium">Appointment Date</p>
<p className="text-sm text-muted-foreground">
{formatDate(appointment.appointmentDate!)} , {appointment.slot?.startTime}
{format(appointment.appointmentDate!, "PPPP")} , {appointment.slot?.startTime}
</p>
</div>
</div>
Expand Down Expand Up @@ -124,7 +121,7 @@ export default function AppointmentSuccessPage() {
<ButtonV2 variant={"gooeyLeft"} asChild>
<Link href={`/appointments/${appointment?._id}`}>Show Details</Link>
</ButtonV2>
<ButtonV2 variant={"shine"} asChild>
<ButtonV2 variant={"ringHover"} asChild>
<Link href="/new-appointment">Book Another Appointment</Link>
</ButtonV2>
</div>
Expand Down
8 changes: 4 additions & 4 deletions client/app/doctor/appointments/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default function AppointmentDetailsPage() {
<GetStatusBadge status={appointment.status || AppointmentStatus.PENDING} />
{appointment.status === AppointmentStatus.PENDING && (
<>
<ButtonV2 variant="linkHover2" onClick={handleAcceptAppointment} disabled={isPending}>
<ButtonV2 variant="secondary" onClick={handleAcceptAppointment} disabled={isPending}>
Accept
</ButtonV2>
<ButtonV2 variant="destructive" onClick={() => setCancelModelOpen(true)}>
Expand All @@ -111,7 +111,7 @@ export default function AppointmentDetailsPage() {
</div>
</div>

<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
<div className="grid grid-cols-1 gap-6">
<Card className="lg:col-span-2">
<CardHeader>
<CardTitle className="flex items-center">
Expand All @@ -123,7 +123,7 @@ export default function AppointmentDetailsPage() {
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<div className="flex items-center space-x-2">
<Clock className="w-5 h-5 text-primary" />
<span>{format(new Date(appointment.appointmentDate!), "PPP")}</span>
<span>{format(new Date(appointment.appointmentDate!), "PPPP")}</span>
</div>
<div className="flex items-center space-x-2">
<Clock className="w-5 h-5 text-primary" />
Expand All @@ -141,7 +141,7 @@ export default function AppointmentDetailsPage() {
<div className="bg-muted p-4 rounded-lg">
<h3 className="font-semibold mb-2 flex items-center">
<FileText className="w-5 h-5 mr-2 text-primary" />
Reason for Visit
Reason for Appointment
</h3>
<p>{appointment.reason}</p>
</div>
Expand Down
5 changes: 1 addition & 4 deletions client/components/layout/DoctorLayoutWithSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,7 @@ const AdminLayoutWithSideBar = ({
</Sheet>
<div className="flex flex-1 items-center gap-4 admin-nav:hidden">
<form className="ml-auto flex-1 sm:flex-initial">
<div className="relative">
<Search className="absolute left-2.5 top-2 h-4 w-4 text-muted-foreground" />
<Input type="search" placeholder="Search..." className="pl-8 h-8 text-sm sm:w-[300px]" />
</div>
<div className="relative" />
</form>
<NotificationButtonDoctor />
<DropdownMenu>
Expand Down
4 changes: 3 additions & 1 deletion client/components/view/table/DoctorAppointmentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import Pagination from "@/components/navigation/Pagination";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import GetStatusBadge from "@/components/doctor/appointment/GetStatusBadge";
import { ButtonV2 } from "@/components/common/ButtonV2";
import { format } from 'date-fns'


const columns = [
{ name: "Date", width: "w-1/5" },
Expand Down Expand Up @@ -114,7 +116,7 @@ export default function AppointmentTable({ page }: Props) {
appointments.map((appointment) => (
<TableRow key={appointment._id}>
<TableCell>
{new Date(appointment.appointmentDate!).toLocaleString().split(",")[0]}
{format(new Date(appointment.appointmentDate!), "PPPP")}
</TableCell>
<TableCell>{appointment.appointmentType}</TableCell>
<TableCell>{appointment.reason}</TableCell>
Expand Down

0 comments on commit 763a907

Please sign in to comment.