Skip to content

Commit

Permalink
fix: imprecise age count
Browse files Browse the repository at this point in the history
  • Loading branch information
rnmeow committed Oct 19, 2024
1 parent 3b9c870 commit 035931c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"h3": "^1.7.1",
"highlight.js": "^11.8.0",
"js-base64": "^3.7.5",
"longevity-js": "^0.0.2",
"markdown-it": "^13.0.1",
"markdown-it-anchor": "^8.6.7",
"markdown-it-emoji": "^2.0.2",
Expand Down
6 changes: 2 additions & 4 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@

<script lang="ts" setup>
import VueWriter from 'vue-writer'
import { calcAge } from 'longevity-js'
import { SOCIAL_LINKS } from '@/config/links'
if (process.client) {
Expand Down Expand Up @@ -113,8 +114,5 @@ onMounted(() => {
emailAddr.value = localStorage.getItem('email')
})
const age = (
(new Date().getTime() - Date.parse(atob('MjAwOC0xMC0xOQ=='))) /
(24 * 60 * 60 * 1000 * 365)
).toFixed(2)
const age = calcAge(new Date('2008-10-19T21:30:00.000+08:00')).toFixed(2)
</script>
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5593,6 +5593,11 @@ longest@^2.0.1:
resolved "https://registry.yarnpkg.com/longest/-/longest-2.0.1.tgz#781e183296aa94f6d4d916dc335d0d17aefa23f8"
integrity sha512-Ajzxb8CM6WAnFjgiloPsI3bF+WCxcvhdIG3KNA2KN962+tdBsHcuQ4k4qX/EcS/2CRkcc0iAkR956Nib6aXU/Q==

longevity-js@^0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/longevity-js/-/longevity-js-0.0.2.tgz#faa6facce92ba04f17192defd49341ad203e63c1"
integrity sha512-eh2DVJbOOp3ZvGAsdePC4JTZyrAKuWo1DIpBnfvY7rtMxU0yxYd2rZouU6y5lUHkQHIG9cMNphsjkAeeUsFixg==

lru-cache@^10.0.1, lru-cache@^10.2.0, "lru-cache@^9.1.1 || ^10.0.0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3"
Expand Down

0 comments on commit 035931c

Please sign in to comment.