From 414b1c71648b4c0923fe64bb449932fc330daef7 Mon Sep 17 00:00:00 2001 From: Ou Date: Wed, 23 Oct 2024 03:39:20 +0800 Subject: [PATCH] chore: test parseRelativeDate in cloudflare --- server/sources/gelonghui.ts | 1 - server/utils/date.ts | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/server/sources/gelonghui.ts b/server/sources/gelonghui.ts index 66068c5..17860c6 100644 --- a/server/sources/gelonghui.ts +++ b/server/sources/gelonghui.ts @@ -15,7 +15,6 @@ export default defineSource(async () => { const info = $(el).find(".time > span:nth-child(1)").text() // 第三个 p const relatieveTime = $(el).find(".time > span:nth-child(3)").text() - console.log(relatieveTime) if (url && title && relatieveTime) { news.push({ url: baseURL + url, diff --git a/server/utils/date.ts b/server/utils/date.ts index fa2c006..789a5eb 100644 --- a/server/utils/date.ts +++ b/server/utils/date.ts @@ -150,6 +150,7 @@ export function parseRelativeDate(date: string, timezone: string = "UTC") { const matches = theDate.match(/\D*\d+(?![:\-/]|(a|p)m)\D+/g) const offset = dayjs.duration({ hours: (dayjs().tz(timezone).utcOffset() - dayjs().utcOffset()) / 60 }) + console.log((dayjs().tz(timezone).utcOffset() - dayjs().utcOffset()) / 60) if (matches) { // 获得最后的时间单元,如 `\d+秒前`