chore: test parseRelativeDate in cloudflare

This commit is contained in:
Ou 2024-10-23 03:39:20 +08:00
parent 182af0cf9a
commit 414b1c7164
2 changed files with 1 additions and 1 deletions

View File

@ -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,

View File

@ -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+秒前`