fix: timestamp calculation

This commit is contained in:
Julian Lam
2024-02-14 10:23:06 -05:00
parent 76d5feb7d6
commit 6a11c89b90

View File

@@ -73,9 +73,7 @@ inbox.like = async (req) => {
inbox.announce = async (req) => {
const { actor, object, published, to, cc } = req.body;
let timestamp = new Date(published);
if (timestamp.toString() === 'Invalid Date') {
timestamp = Date.now();
}
timestamp = timestamp.toString() !== 'Invalid Date' ? timestamp.getTime() : Date.now();
const assertion = await activitypub.actors.assert(actor);
if (!assertion) {