Use SnowflakeUtil.deconstruct
This commit is contained in:
parent
afab564628
commit
71cc3176f6
1 changed files with 2 additions and 6 deletions
|
@ -1,10 +1,6 @@
|
||||||
import moment from "moment";
|
import { Snowflake, SnowflakeUtil } from "discord.js";
|
||||||
|
|
||||||
const EPOCH = 1420070400000;
|
|
||||||
|
|
||||||
export function idToTimestamp(id: string) {
|
export function idToTimestamp(id: string) {
|
||||||
if (typeof id === "number") return null;
|
if (typeof id === "number") return null;
|
||||||
return moment(+id / 4194304 + EPOCH)
|
return SnowflakeUtil.deconstruct(id as Snowflake).timestamp;
|
||||||
.utc()
|
|
||||||
.valueOf();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue