trends: calculate since the last label date instead of current date
This commit is contained in:
parent
1151f0c28b
commit
c6da216b4e
|
@ -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) => ({
|
||||||
|
|
Loading…
Reference in New Issue