fix: the invalid time zone calculation for feature posts.
This commit is contained in:
parent
60f95349d8
commit
149e331380
@ -2,6 +2,7 @@
|
|||||||
import FeaturePost from '@/components/page/post/FeaturePost.astro';
|
import FeaturePost from '@/components/page/post/FeaturePost.astro';
|
||||||
import type { Post } from '@/helpers/schema';
|
import type { Post } from '@/helpers/schema';
|
||||||
import options from '@/options';
|
import options from '@/options';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
posts: Post[];
|
posts: Post[];
|
||||||
@ -16,8 +17,8 @@ const historicalPosts = (): Post[] => {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const now = new Date();
|
const now = DateTime.now().setZone(options.settings.timeZone);
|
||||||
const radical = now.getMonth() + now.getDate();
|
const radical = now.month + now.day;
|
||||||
|
|
||||||
return [posts[offset + radical - 1], posts[offset + radical + 43 - 1], posts[offset + radical + 43 * 2 - 1]];
|
return [posts[offset + radical - 1], posts[offset + radical + 43 - 1], posts[offset + radical + 43 * 2 - 1]];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user