fix(route): 战争雷霆英文官网-新闻版块 时区问题 (#10563)

* fix warthunder timezone issue

* add ;

* add timezone

* fix time zone issue
This commit is contained in:
Axojhf
2022-08-22 16:02:51 +06:00
committed by GitHub
parent f78ad0319e
commit 7504faaedc
3 changed files with 5 additions and 1 deletions
+1
View File
@@ -288,5 +288,6 @@ Steam provides some official RSS feeds:
<RouteEn author="axojhf" example="/warthunder/news" path="/warthunder/news">
News data from https://warthunder.com/en/news/
The year, month and day provided under UTC time zone are the same as the official website, so please ignore the specific time!!!
</RouteEn>
+1
View File
@@ -500,6 +500,7 @@ Steam 新闻中心支持官方的 RSS 订阅:
<Route author="axojhf" example="/warthunder/news" path="/warthunder/news">
News 的数据来自 <https://warthunder.com/en/news/>
在UTC时区下提供的年月日与官网上一致,请忽略具体的时间!!!
</Route>
+3 -1
View File
@@ -3,6 +3,7 @@ const cheerio = require('cheerio');
const path = require('path');
const { art } = require('@/utils/render');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
const renderDescription = (desc) => art(path.join(__dirname, 'templates/description.art'), desc);
module.exports = async (ctx) => {
@@ -15,7 +16,8 @@ module.exports = async (ctx) => {
const pageFace = $('div.showcase__item.widget')
.map((_, item) => {
item = $(item);
const pubDate = parseDate(item.find('div.widget__content > ul > li').text(), 'D MMMM YYYY');
let pubDate = parseDate(item.find('div.widget__content > ul > li').text(), 'D MMMM YYYY');
pubDate = timezone(pubDate, 0);
const category = [];
if (item.find('div.widget__pin').length !== 0) {
category.push('pinned');