const fs = require('fs');
const path = 'C:/Users/CSH12/Desktop/AI_Pharamcy_Frontend/AI_Pharmacy_Application/src/pages/Inventory.tsx';
let content = fs.readFileSync(path, 'utf8');
const targetStr = `return {date.toLocaleDateString()};`;
const replacementStr = `const formattedDate = isNaN(date.getTime()) ? info.getValue() : date.toLocaleDateString('en-GB', { day: '2-digit', month: '2-digit', year: 'numeric' });\n return {formattedDate};`;
if (content.includes(targetStr)) {
content = content.replace(targetStr, replacementStr);
fs.writeFileSync(path, content);
console.log("SUCCESS: Replaced date.toLocaleDateString() with DD/MM/YYYY formatting!");
} else {
console.log("Target string not found in Inventory.tsx");
}