From 339699c6697afe1d6935f84e72c5282d8f832e7b Mon Sep 17 00:00:00 2001 From: Erik Taubeneck Date: Fri, 7 Jun 2024 23:29:23 -0700 Subject: [PATCH] add timestamp to query displayid, remove token --- server/app/query/haikunator.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/app/query/haikunator.tsx b/server/app/query/haikunator.tsx index 529cef7..788b932 100644 --- a/server/app/query/haikunator.tsx +++ b/server/app/query/haikunator.tsx @@ -6,6 +6,16 @@ const haikunator = new Haikunator({ nouns: nouns, }); +function getCurrentTimestamp() { + const now = new Date(); + const year = now.getFullYear(); + const month = (now.getMonth() + 1).toString().padStart(2, '0'); + const day = now.getDate().toString().padStart(2, '0'); + const hours = now.getHours().toString().padStart(2, '0'); + const minutes = now.getMinutes().toString().padStart(2, '0'); + return `${year}-${month}-${day}T${hours}${minutes}`; +} + export default function NewQueryId(): string { - return haikunator.haikunate(); + return haikunator.haikunate({tokenLength: 0}) + getCurrentTimestamp(); }