Skip to content

Commit a3e1ab0

Browse files
committed
replace date-fns with temporal
1 parent 2884465 commit a3e1ab0

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

app/utils/patch.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import { differenceInDays } from "date-fns"
1+
import { Temporal } from "temporal-polyfill"
22

33
import type { Patch } from "~~/lib/types"
44

5-
export const isRecentlyReleased = (patch: Patch | null | undefined) =>
6-
patch != null && differenceInDays(Date.now(), new Date(patch.releasedAt!)) < 7
5+
export const isRecentlyReleased = (patch: Patch | null | undefined): boolean => {
6+
if (patch == null) return false
7+
8+
const now = Temporal.Now.plainDateISO()
9+
const releasedAt = Temporal.PlainDateTime.from(patch.releasedAt!)
10+
const between = releasedAt.until(now, { smallestUnit: "hour" })
11+
return between.days < 7
12+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
"dependencies": {
3333
"@vueuse/core": "13.3.0",
3434
"canvas-confetti": "1.9.3",
35-
"date-fns": "4.1.0",
3635
"dotaver": "1.0.1",
3736
"p-queue": "8.1.0",
38-
"pino": "9.7.0"
37+
"pino": "9.7.0",
38+
"temporal-polyfill": "0.3.0"
3939
},
4040
"devDependencies": {
4141
"@antfu/eslint-config": "4.13.2",

pnpm-lock.yaml

Lines changed: 15 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
onlyBuiltDependencies:
2-
- "@morev/vue-transitions"
3-
41
overrides:
52
"@cloudflare/kv-asset-handler": "-"
63
"@netlify/cli": "-"
@@ -20,3 +17,6 @@ overrides:
2017

2118
patchedDependencies:
2219
"@unocss/nuxt": patches/@unocss__nuxt.patch
20+
21+
onlyBuiltDependencies:
22+
- "@morev/vue-transitions"

0 commit comments

Comments
 (0)