diff --git a/src/controllers/storeController.js b/src/controllers/storeController.js index 6d72e027..697ddfcb 100644 --- a/src/controllers/storeController.js +++ b/src/controllers/storeController.js @@ -1280,7 +1280,13 @@ exports.getusersofParticularInstaller = async (req, reply) => { }; -const dayjs = require('dayjs'); // Install this library using npm install dayjs +const dayjs = require('dayjs'); +const utc = require('dayjs/plugin/utc'); +const timezone = require('dayjs/plugin/timezone'); + +// Extend dayjs with UTC and timezone plugins +dayjs.extend(utc); +dayjs.extend(timezone); exports.createquotationforSensor = async (req, reply) => { try { @@ -1297,21 +1303,21 @@ exports.createquotationforSensor = async (req, reply) => { text: item.text || "", })); - // Format current date and time - const formattedDateTime = dayjs().format('DD-MMM-YYYY - HH:mm'); + // Format current date and time in IST + const formattedDateTime = dayjs().tz("Asia/Kolkata").format('DD-MMM-YYYY - HH:mm'); // Create a new SensorQuotation document const newQuotation = new SensorQuotation({ quatationId, customerId: customerId, installationId: installationId, - quote_status: "Installer Ki pampina,Vaadu reply ivvale inka", + quote_status: "sentfrominstaller", masters, slaves, sensors, motor_switches, electricals: formattedElectricals, - datetime: formattedDateTime, // Add the formatted date and time + datetime: formattedDateTime, // Add the formatted IST date and time }); const savedQuotation = await newQuotation.save();