mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
feat(SnowflakeUtil): add timestampFrom (#7058)
This commit is contained in:
@@ -70,6 +70,15 @@ class SnowflakeUtil extends null {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the timestamp field's value from a Discord snowflake.
|
||||
* @param {Snowflake} snowflake Snowflake to get the timestamp value from
|
||||
* @returns {number}
|
||||
*/
|
||||
static timestampFrom(snowflake) {
|
||||
return Number(BigInt(snowflake) >> 22n) + EPOCH;
|
||||
}
|
||||
|
||||
/**
|
||||
* Discord's epoch value (2015-01-01T00:00:00.000Z).
|
||||
* @type {number}
|
||||
|
||||
Reference in New Issue
Block a user