(str: string)
| 7 | return SnowFlake.stringToUnixTime(this.id); |
| 8 | } |
| 9 | static stringToUnixTime(str: string) { |
| 10 | try { |
| 11 | return Number((BigInt(str) >> 22n) + 1420070400000n); |
| 12 | } catch { |
| 13 | throw new Error( |
| 14 | `The ID is corrupted, it's ${JSON.stringify(str)} when it should be some number.`, |
| 15 | ); |
| 16 | } |
| 17 | } |
| 18 | static DateToID(date: Date) { |
| 19 | return ((BigInt(+date) - 1420070400000n) << 22n).toString(); |
| 20 | } |
nothing calls this directly
no outgoing calls
no test coverage detected