fix(route/the): Fix timezone (#16829)

* fix(route/the): Fix timezone

* .
This commit is contained in:
Andvari
2024-09-20 21:56:52 +08:00
committed by GitHub
parent 7ad41f89c0
commit 22325976ae
+3 -2
View File
@@ -9,6 +9,7 @@ import { art } from '@/utils/render';
import path from 'node:path';
import { apiSlug, bakeFilterSearchParams, bakeFiltersWithPair, bakeUrl, fetchData, getFilterParamsForUrl, parseFilterStr } from './util';
import timezone from '@/utils/timezone';
export const handler = async (ctx) => {
const { filter } = ctx.req.param();
@@ -78,7 +79,8 @@ export const handler = async (ctx) => {
return {
title: item.title?.rendered ?? item.title ?? title,
description,
pubDate: parseDate(item.date_gmt),
pubDate: timezone(parseDate(item.date_gmt), 0),
updated: timezone(parseDate(item.modified_gmt), 0),
link: item.link,
category: [...new Set(terminologies.flat().map((c) => c.name))],
author: item._embedded.author.map((a) => a.name).join('/'),
@@ -88,7 +90,6 @@ export const handler = async (ctx) => {
html: description,
text: $$.text(),
},
updated: parseDate(item.modified_gmt),
};
});