Added missing Profile element
- User's "joined" info
This commit is contained in:
@@ -51,6 +51,11 @@ class Profile extends Shadow {
|
|||||||
.color("var(--headertext")
|
.color("var(--headertext")
|
||||||
.width(70, pct)
|
.width(70, pct)
|
||||||
.textAlign("center")
|
.textAlign("center")
|
||||||
|
.marginBottom(0.25, em)
|
||||||
|
|
||||||
|
p("Joined " + this.convertDate(this.profile.created))
|
||||||
|
.color("var(--headertext)")
|
||||||
|
.marginBottom(0.5, em)
|
||||||
|
|
||||||
h2("Bio")
|
h2("Bio")
|
||||||
.color("var(--headertext")
|
.color("var(--headertext")
|
||||||
@@ -113,7 +118,28 @@ class Profile extends Shadow {
|
|||||||
.position("fixed")
|
.position("fixed")
|
||||||
.top(20, px)
|
.top(20, px)
|
||||||
.zIndex(1000)
|
.zIndex(1000)
|
||||||
// })
|
}
|
||||||
|
|
||||||
|
convertDate(rawDate) {
|
||||||
|
const parsed = new Date(rawDate);
|
||||||
|
|
||||||
|
if (isNaN(parsed.getTime())) return rawDate;
|
||||||
|
|
||||||
|
const month = parsed.toLocaleString("en-US", { month: "long", timeZone: "UTC" });
|
||||||
|
const day = parsed.getUTCDate();
|
||||||
|
const year = parsed.getUTCFullYear();
|
||||||
|
|
||||||
|
const ordinal = (n) => {
|
||||||
|
const mod100 = n % 100;
|
||||||
|
if (mod100 >= 11 && mod100 <= 13) return `${n}th`;
|
||||||
|
switch (n % 10) {
|
||||||
|
case 1: return `${n}st`;
|
||||||
|
case 2: return `${n}nd`;
|
||||||
|
case 3: return `${n}rd`;
|
||||||
|
default: return `${n}th`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return `${month} ${ordinal(day)}, ${year}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user