mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 17:30:07 +00:00
14 lines
398 B
TypeScript
14 lines
398 B
TypeScript
import type { BigString } from '@discordeno/types'
|
|
|
|
export function snowflakeToBigint(snowflake: BigString): bigint {
|
|
return BigInt(snowflake)
|
|
}
|
|
|
|
export function bigintToSnowflake(snowflake: BigString): string {
|
|
return snowflake ? snowflake.toString() : ''
|
|
}
|
|
|
|
export function snowflakeToTimestamp(snowflake: BigString): number {
|
|
return Number(BigInt(snowflake) / 4194304n + 1420070400000n)
|
|
}
|