fix(backend/get-following-birthday-users): 一部の月でbirthdayのタイムスタンプが1ヶ月ズレる問題を修正 (MisskeyIO#587)
This commit is contained in:
parent
9f6b433df2
commit
eeedd500bb
|
@ -126,13 +126,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
)
|
)
|
||||||
).map(u => [u.id, u]));
|
).map(u => [u.id, u]));
|
||||||
|
|
||||||
|
const now = new Date();
|
||||||
return birthdayUsers
|
return birthdayUsers
|
||||||
.map(item => {
|
.map(item => {
|
||||||
const birthday = new Date();
|
const birthday = new Date(
|
||||||
birthday.setMonth(Math.floor(item.birthday_date / 100) - 1);
|
now.getFullYear(),
|
||||||
birthday.setDate(item.birthday_date % 100);
|
Math.floor(item.birthday_date / 100) - 1,
|
||||||
birthday.setHours(0, 0, 0, 0);
|
item.birthday_date % 100,
|
||||||
if (birthday.getTime() < Date.now()) birthday.setFullYear(new Date().getFullYear() + 1);
|
0, 0, 0, 0,
|
||||||
|
);
|
||||||
|
if (birthday.getTime() < now.getTime()) birthday.setFullYear(now.getFullYear() + 1);
|
||||||
return { birthday: birthday.toISOString(), user: users.get(item.user_id) };
|
return { birthday: birthday.toISOString(), user: users.get(item.user_id) };
|
||||||
})
|
})
|
||||||
.filter(item => item.user !== undefined)
|
.filter(item => item.user !== undefined)
|
||||||
|
|
Loading…
Reference in a new issue