chnage time to PKST

main
saif 2025-02-18 10:27:56 +05:00
parent f4b921f6c7
commit 3bca2bacde
5 changed files with 18 additions and 8 deletions

View File

@ -10,7 +10,7 @@ const utils = require("./utils");
(async function () {
console.log(
`===========< STARTED BUY SHIPPING ${luxon.DateTime.now()} >=========`
`===========< STARTED BUY SHIPPING ${utils.getPakistanStandardTime(luxon.DateTime.now())} >=========`
);
const syncDate = luxon.DateTime.now().toFormat("yyyy-MM-dd");
@ -544,7 +544,7 @@ const utils = require("./utils");
}
}
console.log(`==========< ENDED BUY SHIPPING ${luxon.DateTime.now()} >==========`);
console.log(`==========< ENDED BUY SHIPPING ${utils.getPakistanStandardTime(luxon.DateTime.now())} >==========`);
await page.close();
await browser.close();
})();

View File

@ -10,7 +10,7 @@ const utils = require("./utils");
(async function () {
console.log(
`===========< STARTED --- DOWNLOAD SHIPPING LABELS ${luxon.DateTime.now()} >=========`
`===========< STARTED --- DOWNLOAD SHIPPING LABELS ${utils.getPakistanStandardTime(luxon.DateTime.now())} >=========`
);
const syncDate = luxon.DateTime.now().toFormat("yyyy-MM-dd");
@ -402,7 +402,7 @@ const utils = require("./utils");
// await updateState(1, luxon.DateTime.now().toISO());
console.log(
`==========< ENDED --- DOWNLOAD SHIPPING LABELS ${luxon.DateTime.now()} >==========`
`==========< ENDED --- DOWNLOAD SHIPPING LABELS ${utils.getPakistanStandardTimeluxon.DateTime.now()} >==========`
);
await page.close();
await browser.close();

View File

@ -10,7 +10,7 @@ const dotenv = require("dotenv").config({ path: __dirname + "/.env" });
const utils = require("./utils");
(async function () {
console.log(`===========< STARTED ${luxon.DateTime.now()} >=========`);
console.log(`===========< STARTED ${utils.getPakistanStandardTime(luxon.DateTime.now())} >=========`);
const syncDate = luxon.DateTime.now().toFormat("yyyy-MM-dd");
@ -285,7 +285,7 @@ const utils = require("./utils");
};
convertExcelToJson();
console.log(`==========< ENDED ${luxon.DateTime.now()} >==========`);
console.log(`==========< ENDED ${utils.getPakistanStandardTime(luxon.DateTime.now())} >==========`);
await page.close();
await browser.close();
})();

View File

@ -9,7 +9,7 @@ const dotenv = require("dotenv").config({ path: __dirname + "/.env" });
const utils = require("./utils");
(async function () {
console.log(`===========< STARTED ${luxon.DateTime.now()} >=========`);
console.log(`===========< STARTED ${utils.getPakistanStandardTime(luxon.DateTime.now())} >=========`);
const syncDate = luxon.DateTime.now().toFormat("yyyy-MM-dd");
/**
@ -598,7 +598,7 @@ const utils = require("./utils");
}
}
console.log(`==========< ENDED ${luxon.DateTime.now()} >==========`);
console.log(`==========< ENDED ${utils.getPakistanStandardTime(luxon.DateTime.now())} >==========`);
await page.close();
await browser.close();
})();

View File

@ -1,6 +1,7 @@
const crypto = require("crypto");
const { authenticator } = require("otplib");
const dotenv = require("dotenv").config({ path: __dirname + "/.env" });
const { DateTime } = require("luxon");
/**
* get crypto config
@ -323,3 +324,12 @@ const getFirstDayToCurrentMonth = function( ){
return firstDay.toISOString().split('T')[0];
}
exports.getFirstDayToCurrentMonth = getFirstDayToCurrentMonth;
/**
* write a function to convert UTC into pakistan standard time using luxon libraryy in 12 hour
*/
const getPakistanStandardTime = function( utcTime ){
return DateTime.fromISO( utcTime ).setZone('Asia/Karachi').toFormat('dd-MMM-yyyy HH:mm:ss a');
}
exports.getPakistanStandardTime = getPakistanStandardTime;