commit
8d5e9c02ad
7 changed files with 10 additions and 34 deletions
@ -0,0 +1,8 @@ |
|||||||
|
id |
||||||
|
4739537f3d29e1047a45c254 |
||||||
|
title |
||||||
|
Example post for my new post page! |
||||||
|
date |
||||||
|
Mon, 11 May 2020 13:25:00 GMT |
||||||
|
content |
||||||
|
My new posts page is live |
@ -1,4 +0,0 @@ |
|||||||
import { age } from "./lib/me.mjs" |
|
||||||
|
|
||||||
const age_span = document.getElementById("age") |
|
||||||
age_span.textContent = age().toString() |
|
@ -1,17 +0,0 @@ |
|||||||
export function age() { |
|
||||||
let birthdate = new Date("29 August 2002") |
|
||||||
let now = new Date() |
|
||||||
|
|
||||||
let age = now.getFullYear() - birthdate.getFullYear() |
|
||||||
|
|
||||||
if (now.getMonth() < birthdate.getMonth()) |
|
||||||
age-- |
|
||||||
|
|
||||||
if ( |
|
||||||
birthdate.getMonth() === now.getMonth() && |
|
||||||
now.getDate() < birthdate.getDate() |
|
||||||
) |
|
||||||
age-- |
|
||||||
|
|
||||||
return age |
|
||||||
} |
|
Loading…
Reference in new issue