aboutsummaryrefslogtreecommitdiff
path: root/src/lib/util.ts
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-10-24 23:19:33 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-10-24 23:19:33 +0300
commit9dfd6aa77518b3a1e6bfd926a3b7719c32a8c97f (patch)
treed10fc76ef816160871e3955aa75821bc5d5088d4 /src/lib/util.ts
parent4ca81621e5b31922565b4149ebad1deb5161071a (diff)
use the new api
Diffstat (limited to 'src/lib/util.ts')
-rw-r--r--src/lib/util.ts27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/lib/util.ts b/src/lib/util.ts
index b6dd442..8434c86 100644
--- a/src/lib/util.ts
+++ b/src/lib/util.ts
@@ -1,23 +1,12 @@
-export const creatorColor = (creatorid: string) => {
- let parts = creatorid.split('-')
- let ints = parts.map(function(d) { return parseInt(d,16) })
- let code = ints[0]
-
- let blue = (code >> 16) & 31;
- let green = (code >> 21) & 31;
- let red = (code >> 27) & 31;
- let foreColor = `border:5px solid rgb(${red << 3}, ${green << 3}, ${blue << 3});`;
- return foreColor;
-};
-
export function formatTime(timestamp: number): string
{
- let date = new Date(timestamp);
- let year = date.getFullYear();
- let month = date.getMonth() + 1;
- let day = date.getDate();
- let time = date.toTimeString().split(' ')[0];
- let formattedTime = `${time}, ${day}/${month}/${year}`
+ let date = new Date(timestamp*1000);
+ let year = date.getFullYear();
+ let month = date.getMonth() + 1;
+ let day = date.getDate();
+ let time = date.toTimeString().split(' ')[0];
+ console.log(date.toTimeString());
+ let formattedTime = `${time}, ${day}/${month}/${year}`
- return formattedTime;
+ return formattedTime;
}