date issue 7

This commit is contained in:
2025-05-19 08:49:04 +05:30
parent b5132581c0
commit 67dcc94d8e
4 changed files with 18 additions and 2 deletions

View File

@@ -257,7 +257,8 @@ export function AppointmentForm({
: `Appointment with ${selectedStaff?.name}`;
}
const formattedDate = format(data.date, "yyyy-MM-dd");
const formattedDate = data.date.toLocaleDateString("en-CA");
onSubmit({
...data,

View File

@@ -384,11 +384,15 @@ export default function AppointmentsPage() {
? appointmentData.date
: new Date(appointmentData.date); // this is unsafe if it's "yyyy-MM-dd"
console.log("Appoiment date.date ",appointmentData.date);
console.log("Raw date", rawDate);
const updatedData = {
...appointmentData,
date: toUTCDateString(rawDate), // 👈 This ensures consistent date across all environments
};
console.log("update data: ", toUTCDateString(rawDate));
// Check if we're editing an existing appointment with a valid ID
if (
editingAppointment &&

10
package-lock.json generated
View File

@@ -12,6 +12,7 @@
"packages/*"
],
"dependencies": {
"date-fns-tz": "^3.2.0",
"dotenv": "^16.5.0",
"dotenv-cli": "^8.0.0",
"shx": "^0.4.0"
@@ -6360,6 +6361,15 @@
"url": "https://github.com/sponsors/kossnocorp"
}
},
"node_modules/date-fns-tz": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-3.2.0.tgz",
"integrity": "sha512-sg8HqoTEulcbbbVXeg84u5UnlsQa8GS5QXMqjjYIhS4abEVVKIUwe0/l/UhrZdKaL/W5eWZNlbTeEIiOXTcsBQ==",
"license": "MIT",
"peerDependencies": {
"date-fns": "^3.0.0 || ^4.0.0"
}
},
"node_modules/debug": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",

View File

@@ -30,6 +30,7 @@
"packages/*"
],
"dependencies": {
"date-fns-tz": "^3.2.0",
"dotenv": "^16.5.0",
"dotenv-cli": "^8.0.0",
"shx": "^0.4.0"