From c000850d4940d5c1abb97876a485ce8ea5101454 Mon Sep 17 00:00:00 2001 From: Cameron Pettit <71421099+cameronpettit@users.noreply.github.com> Date: Thu, 12 May 2022 15:20:59 -0700 Subject: [PATCH] BRS-296-2: showing date in more places (#93) --- lambda/readPass/index.js | 10 +++++++++- lambda/writePass/index.js | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lambda/readPass/index.js b/lambda/readPass/index.js index be63e51d..8d352e26 100644 --- a/lambda/readPass/index.js +++ b/lambda/readPass/index.js @@ -167,10 +167,18 @@ exports.handler = async (event, context) => { token; const encodedCancellationLink = encodeURI(cancellationLink); + const dateOptions = { day: 'numeric', month: 'long', year: 'numeric' }; + let formattedDate = new Date(passData.data[0].date).toLocaleDateString('en-US', dateOptions); + if (passData.data[0].type) { + formattedDate += ' (' + passData.data[0].type + ')' + } let personalisation = { registrationNumber: passData.data[0].registrationNumber.toString(), - link: encodedCancellationLink + link: encodedCancellationLink, + date: formattedDate, + parkName: passData.data[0].pk.split('::')[1] || '', + facilityName: passData.data[0].facilityName || '' }; // Send email diff --git a/lambda/writePass/index.js b/lambda/writePass/index.js index 21d0629f..9690eeee 100644 --- a/lambda/writePass/index.js +++ b/lambda/writePass/index.js @@ -161,7 +161,11 @@ exports.handler = async (event, context) => { '&email=' + email + '&park=' + - parkName; + parkName + + '&date=' + + dateselector + + '&type=' + + type; const encodedCancellationLink = encodeURI(cancellationLink);