We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f2f668c commit 1569fc8Copy full SHA for 1569fc8
1 file changed
src/routes/integrations/intercom.ts
@@ -2,6 +2,7 @@ import { FastifyInstance } from 'fastify';
2
import jwt from 'jsonwebtoken';
3
import createOrGetConnection from '../../db';
4
import { User } from '../../entity';
5
+import { getUnixTime } from 'date-fns';
6
7
export default async function (fastify: FastifyInstance): Promise<void> {
8
const con = await createOrGetConnection();
@@ -40,10 +41,7 @@ export default async function (fastify: FastifyInstance): Promise<void> {
40
41
}
42
43
if (user.createdAt) {
- // Intercom expects created_at as Unix timestamp (seconds)
44
- payload.created_at = Math.floor(
45
- new Date(user.createdAt).getTime() / 1000,
46
- );
+ payload.created_at = getUnixTime(user.createdAt);
47
48
49
// Sign with HS256 and short expiry (10 minutes recommended minimum)
0 commit comments