seyfert/packages/biscuit/Snowflake.ts
2022-07-08 01:33:29 -05:00

13 lines
278 B
TypeScript

/** snowflake type */
export type Snowflake = string;
/** Discord epoch */
export const DiscordEpoch = 14200704e5;
/** utilities for Snowflakes */
export const Snowflake = {
snowflakeToTimestamp(id: Snowflake) {
return (Number(id) >> 22) + DiscordEpoch;
},
};