From 9ccb9f81d21f06afa4d78edcbf4c38dd7b1797df Mon Sep 17 00:00:00 2001 From: Gabriele De Rosa Date: Thu, 15 Aug 2024 14:18:29 +0200 Subject: [PATCH] fix: use correct time zone --- package-lock.json | 13 +++++++++++++ package.json | 1 + src/index.ts | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index ca05f31..96519ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "grammy": "^1.27.0", "moment": "^2.30.1", + "moment-timezone": "^0.5.45", "openai": "^4.55.7", "postal-mime": "^2.2.6" }, @@ -1873,6 +1874,18 @@ "node": "*" } }, + "node_modules/moment-timezone": { + "version": "0.5.45", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.45.tgz", + "integrity": "sha512-HIWmqA86KcmCAhnMAN0wuDOARV/525R2+lOLotuGFzn4HO+FH+/645z2wx0Dt3iDv6/p61SIvKnDstISainhLQ==", + "license": "MIT", + "dependencies": { + "moment": "^2.29.4" + }, + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/package.json b/package.json index 679f93b..dae64b3 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "dependencies": { "grammy": "^1.27.0", "moment": "^2.30.1", + "moment-timezone": "^0.5.45", "openai": "^4.55.7", "postal-mime": "^2.2.6" } diff --git a/src/index.ts b/src/index.ts index 594438a..85ad172 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ // Dependencies. import PostalMime from 'postal-mime'; import { Bot, InputFile } from 'grammy'; -import moment from 'moment'; +import moment from 'moment-timezone'; import { Env } from './env'; import { llm } from './llm'; @@ -50,7 +50,7 @@ export default { // Generate message. const msg = '☎️ ' + caller + '\n' - + '📅 ' + moment().format('YYYY-MM-DD, hh:mm') + '\n' + + '📅 ' + moment().tz(env.TZ ? env.TZ : 'UTC').format('YYYY-MM-DD, HH:mm') + '\n' + '💬 `' + transcribedAudio + '`'; // Send the summary to the user.