fix: fix timezone for GMT+8 (#22270)

* fix: fix timezone for GMT+8

* fix: update +8 to 8
This commit is contained in:
Jiamin
2026-07-05 18:03:12 +00:00
committed by GitHub
parent bb722f74be
commit 719cc1994b
3 changed files with 7 additions and 4 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ import type { DataItem, Route } from '@/types';
import cache from '@/utils/cache';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
import { namespace } from './namespace';
@@ -108,7 +109,7 @@ export const route: Route = {
const $detail = load(detailResponse.data);
const pubDateStr = $detail('meta[name="PubDate"]').attr('content') || '';
const pubDate = parseDate(pubDateStr, 'YYYY-MM-DD HH:mm');
const pubDate = timezone(parseDate(pubDateStr, 'YYYY-MM-DD HH:mm'), 8);
const description = renderToString(
<div>
+2 -1
View File
@@ -1,5 +1,6 @@
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
export const route = {
path: '/information/news/:type?',
@@ -67,7 +68,7 @@ export const route = {
return {
title: item.titleDecoded || item.title,
pubDate: parseDate(item.issueTime),
pubDate: timezone(parseDate(item.issueTime), 8),
category: item.infoType?.entryItemName || item.bulletinInfoType?.entryItemName,
link: itemLink,
};
@@ -3,6 +3,7 @@ import { renderToString } from 'hono/jsx/dom/server';
import type { Route } from '@/types';
import got from '@/utils/got';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
import { namespace } from './namespace';
@@ -32,7 +33,7 @@ export const route: Route = {
},
],
handler: async (ctx) => {
const type = ctx.req.param('type')?.toUpperCase();
const type = ctx.req.param('type');
const baseUrl = 'https://www.shanghaimuseum.net';
const apiUrl = `${baseUrl}/mu/frontend/pg/display/search-exhibit`;
@@ -73,7 +74,7 @@ export const route: Route = {
const itemLink = `${baseUrl}/mu/frontend/pg/article/id/${item.code}`;
const imgUrl = item.picPath ? `${baseUrl}/${item.picPath}` : '';
const location = item.exhibitPlace || '上海博物馆';
const pubDate = parseDate(item.issueTime);
const pubDate = timezone(parseDate(item.issueTime), 8);
const fullDuration = item.exhibitDateRange || '';
const [startDate, endDate] = fullDuration.includes(' - ') ? fullDuration.split(' - ').map((s) => s.trim()) : [fullDuration, ''];