From 873aa64b3603b3092ad2807d97e17b7bc341414a Mon Sep 17 00:00:00 2001 From: KATT Date: Fri, 13 Oct 2023 23:51:38 +0200 Subject: [PATCH] coolio --- examples/sse/src/app/api/sse/route.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/sse/src/app/api/sse/route.ts b/examples/sse/src/app/api/sse/route.ts index 23d2f20..1d145cc 100644 --- a/examples/sse/src/app/api/sse/route.ts +++ b/examples/sse/src/app/api/sse/route.ts @@ -9,13 +9,13 @@ export function getResponseShape() { async function* currentTimeGenerator() { // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition while (true) { - await sleep(100); - const date = new Date(); - const hours = date.getHours(); - const minutes = date.getMinutes(); - const seconds = date.getSeconds(); - const time = `${hours}:${minutes}:${seconds}`; - yield time; + yield new Intl.DateTimeFormat("en-US", { + hour: "numeric", + hour12: false, + minute: "numeric", + second: "numeric", + }).format(new Date()); + await sleep(500); } }