From 149e3313800e8ae46297a2519c56dedb8b8194c1 Mon Sep 17 00:00:00 2001 From: Yufan Sheng Date: Thu, 7 Nov 2024 20:39:36 +0800 Subject: [PATCH] fix: the invalid time zone calculation for feature posts. --- src/components/page/post/FeaturePosts.astro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/page/post/FeaturePosts.astro b/src/components/page/post/FeaturePosts.astro index c923e6c..fe0b44f 100644 --- a/src/components/page/post/FeaturePosts.astro +++ b/src/components/page/post/FeaturePosts.astro @@ -2,6 +2,7 @@ import FeaturePost from '@/components/page/post/FeaturePost.astro'; import type { Post } from '@/helpers/schema'; import options from '@/options'; +import { DateTime } from 'luxon'; interface Props { posts: Post[]; @@ -16,8 +17,8 @@ const historicalPosts = (): Post[] => { return []; } - const now = new Date(); - const radical = now.getMonth() + now.getDate(); + const now = DateTime.now().setZone(options.settings.timeZone); + const radical = now.month + now.day; return [posts[offset + radical - 1], posts[offset + radical + 43 - 1], posts[offset + radical + 43 * 2 - 1]]; };