Skip to content

Commit

Permalink
fix(route/the): Fix timezone (DIYgod#16829)
Browse files Browse the repository at this point in the history
* fix(route/the): Fix timezone

* .
  • Loading branch information
dzx-dzx committed Sep 20, 2024
1 parent 7ad41f8 commit 2232597
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/routes/the/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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('/'),
Expand All @@ -88,7 +90,6 @@ export const handler = async (ctx) => {
html: description,
text: $$.text(),
},
updated: parseDate(item.modified_gmt),
};
});

Expand Down

0 comments on commit 2232597

Please sign in to comment.