Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Conversation

v0ctor
Copy link
Contributor

@v0ctor v0ctor commented Nov 16, 2024

This PR sorts tweets by ID instead of date.

It is necessary to sort by ID to ensure that references are never broken.

For example, when importing threads, especially those created all at once from the web interface, the date of two consecutive tweets may be exactly the same.

@marcomaroni-github
Copy link
Owner

@v0ctor This change breaks the checking of MIN_DATE, MAX_DATE parameters, see the comment in the code.

app.ts Outdated
let ad = new Date(a.tweet.created_at).getTime();
let bd = new Date(b.tweet.created_at).getTime();
return ad - bd;
return parseInt(a.tweet.id) - parseInt(b.tweet.id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tweet ids are too big for JS, so don't parse them:

parseInt('1857820252878323986')
1857820252878324000

@v0ctor
Copy link
Contributor Author

v0ctor commented Nov 16, 2024

Thanks for the feedback!

Both things work properly now with the latest commit (tested with SIMULATE=1).

@marcomaroni-github marcomaroni-github merged commit 6a138f0 into marcomaroni-github:main Nov 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants