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 18, 2024
1 parent 3b9c870 commit f330c2e
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.1",
"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.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/longevity-js/-/longevity-js-0.0.1.tgz#263faf5a4a0d78da847e93b292bfc7569f2f02ad"
integrity sha512-XqEQapQsEXy5nXce7/aYVBvys6dzLBeRpeeTMLB14kaJVj1I1zO+y6UVP2rE8hcK1AJ3/9qLd2fKxS5iXsp11A==

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 f330c2e

Please sign in to comment.