trends: calculate since the last label date instead of current date

This commit is contained in:
Alex Gleason 2024-06-11 19:08:24 -05:00
parent 1151f0c28b
commit c6da216b4e
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 3 additions and 3 deletions

View File

@ -164,9 +164,9 @@ export async function getTrendingTags(store: NStore, tagName: string): Promise<T
const tags = label.tags.filter(([name]) => name === tagName); const tags = label.tags.filter(([name]) => name === tagName);
const now = new Date(); const labelDate = new Date(label.created_at * 1000);
const lastWeek = new Date(now.getTime() - Time.days(7)); const lastWeek = new Date(labelDate.getTime() - Time.days(7));
const dates = generateDateRange(lastWeek, now).reverse(); const dates = generateDateRange(lastWeek, labelDate).reverse();
return Promise.all(tags.map(async ([_, value]) => { return Promise.all(tags.map(async ([_, value]) => {
const filters = dates.map((date) => ({ const filters = dates.map((date) => ({