Skip to content

Commit

Permalink
Correct timestamp format for datetimeoffset
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr1sh1 committed Mar 2, 2024
1 parent 29db5d2 commit 0c7c5cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion functions/statusCallback.protected.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ServerlessFunctionSignature } from '@twilio-labs/serverless-runtime-types/types';
import { InsertParams, StatusCallbackServerlessEventObject, TwilioEnvironmentVariables } from './types/interfaces';
import { connect, config, Request } from 'mssql';
import moment from 'moment';

const constructRequest = (request: Request, params: InsertParams) => {
const columns = Object.keys(params).join(", ")
Expand All @@ -19,7 +20,7 @@ export const handler: ServerlessFunctionSignature<TwilioEnvironmentVariables, St
const callerNumber = event.From
const logFileName = decodeURIComponent(event.request.cookies.logFileName) // Could be 'null' if the call was terminated too early
const callStartTimestamp = decodeURIComponent(event.request.cookies.callStartTimestamp)
const callEndTimestamp = event.Timestamp
const callEndTimestamp = moment(event.Timestamp, 'ddd, DD MMM YYYY HH:mm:ss ZZ').format("YYYY-MM-DD HH:mm:ss Z")
const callDurationInSeconds = event.CallDuration

const serverConfig: config = {
Expand Down
2 changes: 1 addition & 1 deletion functions/transcribe.protected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const handler: ServerlessFunctionSignature<TwilioEnvironmentVariables, Co
"Hey! I'm HillingdonLex, a chatbot created to help the residents of Hillingdon. What would you like to talk about today? I could help you order recycling bags, report a street that needs cleaning, request a housing repair or make an adult social care query among other things."
);

const callStartTimestamp = encodeURIComponent(moment().utc().format('ddd, DD MMM YYYY HH:mm:ss ZZ'));
const callStartTimestamp = encodeURIComponent(moment().utc().format("YYYY-MM-DD HH:mm:ss Z"));

response.setCookie('initiated', "true", ['Path=/']);
response.setCookie('callStartTimestamp', callStartTimestamp, ['Path=/']);
Expand Down

0 comments on commit 0c7c5cb

Please sign in to comment.