-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: infzm timezone #7695
fix: infzm timezone #7695
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/rsshub-team/rsshub/HRQ9pYL2kBfX1uZXFsQPYiNj27yj |
Successfully generated as following: https://rsshub-do-not-use-3b9kji9wi-diy.vercel.app/infzm/5 - Success
|
lib/routes/infzm/news.js
Outdated
@@ -16,7 +17,8 @@ module.exports = async (ctx) => { | |||
const data = response.data.data; | |||
const resultItem = await Promise.all( | |||
data.contents.map(async ({ id, subject, author, publish_time }) => { | |||
const date = new Date(publish_time); | |||
// the timezone is GMT+8 | |||
const date = parseDate(`${publish_time}+0800`, 'YYYY-MM-DD HH:mm:SSZZ'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个日期格式化的行为是不是不太对啊?如果你想解析时区,推荐用 https://docs.rsshub.app/joinus/pub-date.html#shi-yong-gong-ju-lei-timezone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我参考过这个链接,因为网站上显示的时间一定是东八区的,我按照 dayjs 提供的格式硬设为东八区了。不这样处理可能会因为服务器时区的不同产生错误的时间
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那使用工具类会产生错误的结果吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样处理后就没问题了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
当时的问题是,因为网页上用的时区总是GMT+8,如果这里不处理,生成的 RSS feed 就丢失了时区信息,在阅读器里就会看到错误的时间
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
工具类一样可以设置时区
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你们是说用 timezone
来设置时区吗?我当时只看了 dayjs 所以没有用,我可以试一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前没仔细看链接的 anchor,抱歉了
Successfully generated as following: https://rsshub-maizmks0g-rsshub-team.vercel.app/infzm/5 - Success
|
* docs: update sponsor * feat: add hotukdeals * feat: hotukdeals radar * feat: add PS5 stock UK - The Independent * fix(route): allow preLoginFlow of instagram to fail (DIYgod#8340) Based on discussion in instragram-private-api repo, we do not need this function for login. See: dilame/instagram-private-api#1411 dilame/instagram-private-api#1417 * style: auto format * feat: pixiv PIXIV_IMG_PROXY * fix: douban guid * feat(route): add Research Gate Publications (DIYgod#7544) * feat(route): add QuestMobile行业研究报告 (DIYgod#7552) * chore: remove no-return-await eslint rule * feat(route): add RSS3 Blog (DIYgod#7566) Co-authored-by: DIYgod <[email protected]> * style: auto format * feat(route): add Odaily星球日报活动 (DIYgod#7666) * feat: remove toutiao * chore: format * feat(route): add fashion network news (DIYgod#7602) Co-authored-by: DIYgod <[email protected]> * feat(route): add dbaplus社群活动 (DIYgod#7584) Co-authored-by: DIYgod <[email protected]> * feat(route): add 德阳考试中心 (DIYgod#7901) * feat(route): add 央视网栏目 (DIYgod#7937) Co-authored-by: DIYgod <[email protected]> * style: auto format * fix: infzm timezone (DIYgod#7695) * fix: undefined error when no magnet & torrent (DIYgod#7745) * feat(route): add World Health Organization News (DIYgod#8022) Co-authored-by: DIYgod <[email protected]> * fix: exclude datanews to prevent `pubDate` error (`/caixin/latest`) (DIYgod#8068) * feat(route): add World Health Organization Speeches (DIYgod#8048) Co-authored-by: DIYgod <[email protected]> * Fix AP News article's title (DIYgod#8086) * feat(route): add Now 熱門新聞 (DIYgod#8093) Co-authored-by: DIYgod <[email protected]> * feat(route): add Uwants (DIYgod#8094) Co-authored-by: DIYgod <[email protected]> * fix: lazyloadRouteHandler * fix: add Lofter话题/标签文章分类 & 视频 (DIYgod#8054) * feat(route): add yunnan normal university (DIYgod#8097) * feat(route): add 香港討論區 (DIYgod#8101) Co-authored-by: DIYgod <[email protected]> * feat(route): add 香港高登 (DIYgod#8109) Co-authored-by: DIYgod <[email protected]> * feat(route): add 华南理工大学教务处学院通知 (DIYgod#8110) * fix(route): incorrect source links in yuzu emulator (DIYgod#8111) * fix(route): migrate initium routes to new timezone (DIYgod#8124) * feat(route): add yahoo japan covid19 news collection 日本疫情消息汇总 (DIYgod#8099) * feat(route): add Asian to lick (DIYgod#8156) Co-authored-by: SettingDust <[email protected]> Co-authored-by: DIYgod <[email protected]> * feat(route): add "micmicidol" (DIYgod#8070) Co-authored-by: SettingDust <[email protected]> Co-authored-by: DIYgod <[email protected]> * feat(route):add 拷贝漫画 (DIYgod#7896) Co-authored-by: SettingDust <[email protected]> Co-authored-by: DIYgod <[email protected]> * feat(route): add SBS中文 (DIYgod#8149) Co-authored-by: DIYgod <[email protected]> * feat(route): add Netflix Newsroom (DIYgod#8135) Co-authored-by: SettingDust <[email protected]> Co-authored-by: NeverBehave <[email protected]> Co-authored-by: DIYgod <[email protected]> * fix(route): 修正北京教育考试院内容提取错误 (DIYgod#8209) * fix(route): dekudeals error due to ad (DIYgod#8214) * feat(route): add 旺球体育直播间 (DIYgod#8276) Co-authored-by: DIYgod <[email protected]> * fix(route): 深圳证券交易所最新规则 (DIYgod#8284) * feat(route): add 人民网领导留言板 (DIYgod#8285) * feat(router): timednews 时刻新闻 (DIYgod#8279) Co-authored-by: Tony <[email protected]> * feat(router): ccac 澳门廉政公署 (DIYgod#8273) Co-authored-by: Tony <[email protected]> * add 安全文摘 (DIYgod#8294) Co-authored-by: testkaili <[email protected]> Co-authored-by: kaiili <[email protected]> * feat(router): cebbank 光大银行 (DIYgod#8293) * feat(route): add NGOCN (DIYgod#8301) Co-authored-by: DIYgod <[email protected]> * chore: format * feat(route): add IT之家专题 (DIYgod#8312) * feat(route)(v2): add 旅法师营地首页 (DIYgod#8350) * feat(route): add 辛華社 (DIYgod#8357) * feat(route): add Literotica Category (DIYgod#8415) * feat(route): add Literotica News Stories (DIYgod#8410) Co-authored-by: DIYgod <[email protected]> * misc: add NOROUTE instruction back to template (DIYgod#8379) Co-authored-by: Sukka <[email protected]> * feat(route): jandan use the origin gif instead the thumbs (DIYgod#8406) * feat(route): add HKJunkCall資訊中心 (DIYgod#8405) * fix(route): fix furstar pic href (DIYgod#8404) * feat(route): add ScienceDirect Journal (DIYgod#8399) * feat(route): add Harvard Business Review Topic (DIYgod#8395) * fix(route)(hket): migrate to v2 (DIYgod#8132) * chore: format Co-authored-by: DIYgod <[email protected]> Co-authored-by: Shizun Ge <[email protected]> Co-authored-by: GitHub Action <[email protected]> Co-authored-by: Ethan Shen <[email protected]> Co-authored-by: DIYgod <[email protected]> Co-authored-by: zytomorrow <[email protected]> Co-authored-by: Sean Chao <[email protected]> Co-authored-by: junfengP <[email protected]> Co-authored-by: Toby Tso <[email protected]> Co-authored-by: ninboy <[email protected]> Co-authored-by: SettingDust <[email protected]> Co-authored-by: Rongrong <[email protected]> Co-authored-by: coxde <[email protected]> Co-authored-by: sgqy <[email protected]> Co-authored-by: KotoriK <[email protected]> Co-authored-by: btdwv <[email protected]> Co-authored-by: NeverBehave <[email protected]> Co-authored-by: erriy <[email protected]> Co-authored-by: Kevin Carter <[email protected]> Co-authored-by: linbuxiao <[email protected]> Co-authored-by: Tony <[email protected]> Co-authored-by: kaiili <[email protected]> Co-authored-by: testkaili <[email protected]> Co-authored-by: kaiili <[email protected]> Co-authored-by: auto-bot-ty <[email protected]> Co-authored-by: Yishuai Li <[email protected]> Co-authored-by: Sukka <[email protected]> Co-authored-by: Oddcc <[email protected]> Co-authored-by: tuzi3040 <[email protected]>
该 PR 相关 Issue / Involved issue
Close #
完整路由地址 / Example for the proposed route(s)
新RSS检查列表 / New RSS Script Checklist
Puppeteer
? Make use ofPuppeteer
?说明 / Note
This commit fixed the previously unhandled timezone issue.