forked from atums.world/backend
start of the 50th remake of a file host doomed to never be finished
This commit is contained in:
commit
46c05ca3a9
33 changed files with 2155 additions and 0 deletions
13
src/helpers/char.ts
Normal file
13
src/helpers/char.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
export function timestampToReadable(timestamp?: number): string {
|
||||
const date: Date =
|
||||
timestamp && !isNaN(timestamp) ? new Date(timestamp) : new Date();
|
||||
if (isNaN(date.getTime())) return "Invalid Date";
|
||||
return date.toISOString().replace("T", " ").replace("Z", "");
|
||||
}
|
||||
|
||||
export function isUUID(uuid: string): boolean {
|
||||
const regex: RegExp =
|
||||
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
||||
|
||||
return regex.test(uuid);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue