From 358b950af482191ba508e6566bb32a10d6b08106 Mon Sep 17 00:00:00 2001 From: SauceyRed Date: Mon, 26 May 2025 22:40:36 +0200 Subject: [PATCH] feat: add uuid v7 to timestamp converter --- utils/uuidToTimestamp.ts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 utils/uuidToTimestamp.ts diff --git a/utils/uuidToTimestamp.ts b/utils/uuidToTimestamp.ts new file mode 100644 index 0000000..78d6b12 --- /dev/null +++ b/utils/uuidToTimestamp.ts @@ -0,0 +1,6 @@ +export default (uuid: string) => { + const parts = uuid.split("-"); + const bits = parts[0] + parts[1].slice(0, 4); + const timestamp = parseInt(bits, 16); + return timestamp; +}