Date formate changed for email
This commit is contained in:
parent
ab2d90d8d2
commit
1868deb813
@ -204,13 +204,27 @@ exports.createSubmission = async (req, res) => {
|
||||
const EstablishmentUserData = await EstablishmentUser.findAll({where: { establishment_id: result.establishment_id, is_active: 1 }});
|
||||
const AdminUsersData = await User.findAll({where: { is_active: 1 }});
|
||||
|
||||
const formatSubmissionDate = (date) => {
|
||||
return new Intl.DateTimeFormat("en-GB", {
|
||||
day: "2-digit",
|
||||
month: "short",
|
||||
year: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: true,
|
||||
timeZone: "Asia/Dubai",
|
||||
timeZoneName: "short"
|
||||
}).format(new Date(date))
|
||||
.replace("GMT+4", "GST (UAE)");
|
||||
};
|
||||
|
||||
// Shared placeholder data
|
||||
const basePlaceholder = {
|
||||
quarter: result.quarter,
|
||||
year: result.year,
|
||||
establishment_name: EstablishmentData.factory_name,
|
||||
submitted_by: result.created_user?.name,
|
||||
submission_date: result.created_at,
|
||||
submission_date: formatSubmissionDate(result.created_at),
|
||||
support_email: process.env.SUPPORT_EMAIL,
|
||||
support_phone: process.env.SUPPORT_PHONE,
|
||||
portal_url: process.env.FE_BASE_URL
|
||||
@ -803,13 +817,28 @@ exports.approveOrRejectSubmission = async (req, res) => {
|
||||
{
|
||||
for await (const userObj of EstablishmentUserData)
|
||||
{
|
||||
|
||||
function formatSubmissionDate(date) {
|
||||
return new Intl.DateTimeFormat("en-GB", {
|
||||
day: "2-digit",
|
||||
month: "short",
|
||||
year: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: true,
|
||||
timeZone: "Asia/Dubai"
|
||||
})
|
||||
.format(new Date(date))
|
||||
.replace(",", "") + " GST (UAE)";
|
||||
}
|
||||
|
||||
placeHolderData = {
|
||||
user_name: sanitizeForLog(userObj.name),
|
||||
portal_url : process.env.FE_BASE_URL,
|
||||
quarter : result['quarter'],
|
||||
year : result['year'],
|
||||
establishment_name : EstablishmentData['factory_name'],
|
||||
submission_date : result['created_at'],
|
||||
submission_date : formatSubmissionDate(result['created_at']),
|
||||
rejection_reason : result['reject_reason'],
|
||||
support_email : process.env.SUPPORT_EMAIL,
|
||||
support_phone : process.env.SUPPORT_PHONE,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user