aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-09 22:10:39 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-09 22:10:39 -0400
commit09120c8799762f7a940f803095f6f0ec91db4aa3 (patch)
tree2ae60282d0084a3ad6b391ec9e09cbd6c8a295f2 /src/lib
parent7635ccdbda1bbf14dd0cca52cd0e8e00e1194d62 (diff)
downloadtanzanite-09120c8799762f7a940f803095f6f0ec91db4aa3.tar.gz
tanzanite-09120c8799762f7a940f803095f6f0ec91db4aa3.tar.bz2
tanzanite-09120c8799762f7a940f803095f6f0ec91db4aa3.zip
added some timestamps
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 77ded3b..c15ca1c 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -1267,8 +1267,12 @@ export class BushClientUtil extends ClientUtil {
* - **F**: Long Date/Time
* - **R**: Relative Time
*/
- public timestamp(date: Date, style: 't' | 'T' | 'd' | 'D' | 'f' | 'F' | 'R' = 'f'): string {
- return `<t:${Math.round(date.getTime() / 1000)}:${style}>`;
+ public timestamp<D extends Date | undefined | null>(
+ date: D,
+ style: 't' | 'T' | 'd' | 'D' | 'f' | 'F' | 'R' = 'f'
+ ): D extends Date ? string : undefined {
+ if (!date) return date as unknown as D extends Date ? string : undefined;
+ return `<t:${Math.round(date.getTime() / 1000)}:${style}>` as unknown as D extends Date ? string : undefined;
}
public dateDelta(date: Date, largest?: number) {