feat: replace luxon to native Date (#2586)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const DateTime = require('luxon').DateTime;
|
||||
|
||||
module.exports = async (subjectID, minLength) => {
|
||||
// bangumi.tv未提供获取“吐槽(comments)”的API,因此仍需要通过抓取网页来获取
|
||||
@@ -31,21 +30,17 @@ module.exports = async (subjectID, minLength) => {
|
||||
.slice(1)
|
||||
.map((s) => (s ? Number(s.slice(0, -2)) : 0));
|
||||
|
||||
date = DateTime.local().minus({
|
||||
days: list[0],
|
||||
hours: list[1],
|
||||
minutes: list[2],
|
||||
});
|
||||
date = new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * list[0] - 1000 * 60 * 60 * list[1] - 1000 * 60 * list[2]).toUTCString();
|
||||
} else {
|
||||
// 表示绝对日期的字符串
|
||||
date = DateTime.fromFormat(dateString, 'yyyy-L-dd HH:mm');
|
||||
date = new Date(dateString).toUTCString();
|
||||
}
|
||||
|
||||
return {
|
||||
user: $el.find('.l').text(),
|
||||
rate: rate || '无',
|
||||
content: $el.find('p').text(),
|
||||
date: date.toRFC2822(),
|
||||
date: date,
|
||||
};
|
||||
})
|
||||
.get()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const got = require('@/utils/got');
|
||||
const DateTime = require('luxon').DateTime;
|
||||
|
||||
module.exports = (type) => {
|
||||
const mapping = {
|
||||
@@ -24,7 +23,7 @@ module.exports = (type) => {
|
||||
title: `${article.user.nickname}:${article.title}`,
|
||||
description: article.summary || '',
|
||||
link: article.url,
|
||||
pubDate: DateTime.fromMillis(article.timestamp * 1000).toRFC2822(),
|
||||
pubDate: new Date(article.timestamp * 1000).toUTCString(),
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
"koa-mount": "4.0.0",
|
||||
"koa-router": "7.4.0",
|
||||
"lru-cache": "5.1.1",
|
||||
"luxon": "1.16.1",
|
||||
"lz-string": "1.4.4",
|
||||
"markdown-it": "8.4.2",
|
||||
"module-alias": "2.2.0",
|
||||
|
||||
@@ -6416,11 +6416,6 @@ lru-cache@^4.0.1, lru-cache@^4.1.2:
|
||||
pseudomap "^1.0.2"
|
||||
yallist "^2.1.2"
|
||||
|
||||
luxon@1.16.1:
|
||||
version "1.16.1"
|
||||
resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.16.1.tgz#62568d483989fa108f5c87178a05bcc707f7698b"
|
||||
integrity sha512-3aYYMFpIRdEQJl00ki+NDr2zx/Ulf7ZgohBUb6ifZQuVkP8/KCYJluISl0YNbvZXBdzCbVhpQnS4M6Svjpn7EA==
|
||||
|
||||
lz-string@1.4.4:
|
||||
version "1.4.4"
|
||||
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26"
|
||||
|
||||
Reference in New Issue
Block a user