Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.

Commit 0634672

Browse files
committed
replace date-dns with days
1 parent 58dc0cc commit 0634672

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

packages/wallets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@types/node": "^22.13.8",
2424
"@types/react": "^19.0.10",
2525
"@vitejs/plugin-react": "^4.3.4",
26-
"date-fns": "4.1.0",
26+
"dayjs": "^1.11.10",
2727
"eslint": "^9.21.0",
2828
"lru-cache": "^11.0.2",
2929
"prettier": "^3.5.2",
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { infiniteQueryOptions } from "@tanstack/react-query";
22
import { HiveMarketMetric } from "../types";
33
import { CONFIG } from "@ecency/sdk";
4-
import { addSeconds, formatISO } from "date-fns";
4+
import dayjs from "dayjs";
55

66
export function getHiveAssetMetricQueryOptions(bucketSeconds = 86_400) {
77
return infiniteQueryOptions({
@@ -12,9 +12,9 @@ export function getHiveAssetMetricQueryOptions(bucketSeconds = 86_400) {
1212
"get_market_history",
1313
[
1414
bucketSeconds,
15-
formatISO(startDate).split("+")[0],
16-
formatISO(endDate).split("+")[0],
17-
]
15+
dayjs(startDate).format("YYYY-MM-DDTHH:mm:ss"),
16+
dayjs(endDate).format("YYYY-MM-DDTHH:mm:ss"),
17+
],
1818
);
1919

2020
return apiData.map(({ hive, non_hive, open }) => ({
@@ -28,15 +28,16 @@ export function getHiveAssetMetricQueryOptions(bucketSeconds = 86_400) {
2828
},
2929
initialPageParam: [
3030
// Fetch at least 8 hours or given interval
31-
addSeconds(new Date(), -Math.max(100 * bucketSeconds, 28_800)),
31+
dayjs()
32+
.subtract(Math.max(100 * bucketSeconds, 28_800), "second")
33+
.toDate(),
3234
new Date(),
3335
],
3436
getNextPageParam: (_, __, [prevStartDate]) => [
35-
addSeconds(
36-
new Date(prevStartDate.getTime()),
37-
-Math.max(100 * bucketSeconds, 28_800)
38-
),
39-
addSeconds(new Date(prevStartDate.getTime()), -bucketSeconds),
37+
dayjs(prevStartDate.getTime())
38+
.subtract(Math.max(100 * bucketSeconds, 28_800), "second")
39+
.toDate(),
40+
dayjs(prevStartDate.getTime()).subtract(bucketSeconds, "second").toDate(),
4041
],
4142
});
4243
}

packages/wallets/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default defineConfig({
3434
"@okxweb3/crypto-lib",
3535
"bip39",
3636
"hivesigner",
37-
"date-fns",
37+
"dayjs",
3838
],
3939
},
4040
},

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,10 +2012,10 @@ data-uri-to-buffer@^4.0.0:
20122012
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"
20132013
integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==
20142014

2015-
date-fns@4.1.0:
2016-
version "4.1.0"
2017-
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-4.1.0.tgz#64b3d83fff5aa80438f5b1a633c2e83b8a1c2d14"
2018-
integrity sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==
2015+
dayjs@^1.11.10:
2016+
version "1.11.13"
2017+
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.13.tgz#92430b0139055c3ebb60150aa13e860a4b5a366c"
2018+
integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==
20192019

20202020
de-indent@^1.0.2:
20212021
version "1.0.2"

0 commit comments

Comments
 (0)