date issue 3
This commit is contained in:
@@ -356,14 +356,23 @@ export default function Dashboard() {
|
|||||||
|
|
||||||
// Since we removed filters, just return all patients
|
// Since we removed filters, just return all patients
|
||||||
const filteredPatients = patients;
|
const filteredPatients = patients;
|
||||||
const today = format(new Date(), "yyyy-MM-dd");
|
const now = new Date();
|
||||||
|
const todayUTC = `${now.getUTCFullYear()}-${String(now.getUTCMonth() + 1).padStart(2, "0")}-${String(now.getUTCDate()).padStart(2, "0")}`;
|
||||||
|
|
||||||
const todaysAppointments = appointments.filter((appointment) => {
|
const todaysAppointments = appointments.filter((appointment) => {
|
||||||
const appointmentDate = typeof appointment.date === "string"
|
const dateObj =
|
||||||
? format(parseISO(appointment.date), "yyyy-MM-dd")
|
typeof appointment.date === "string"
|
||||||
: format(appointment.date, "yyyy-MM-dd");
|
? parseISO(appointment.date)
|
||||||
|
: appointment.date;
|
||||||
|
|
||||||
return appointmentDate === today;
|
// Extract UTC year, month, day from appointment date
|
||||||
|
const year = dateObj.getUTCFullYear();
|
||||||
|
const month = dateObj.getUTCMonth();
|
||||||
|
const day = dateObj.getUTCDate();
|
||||||
|
|
||||||
|
const appointmentUTCDate = `${year}-${String(month + 1).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
||||||
|
|
||||||
|
return appointmentUTCDate === todayUTC;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Count completed appointments today
|
// Count completed appointments today
|
||||||
|
|||||||
Reference in New Issue
Block a user