Something went wrong. Try again.
bluebell's backend for scheduled & auto-deleting posts api.bbell.vt3e.cat
Something went wrong. Try again.
12345678910111213141516171819202122export function encodeCursor(id: string, date: Date): string { const timestamp = date.getTime().toString(36); return `${timestamp}_${id}`;}
export function decodeCursor( cursor: string,): { id: string; date: Date } | null { try { const lastUnderscore = cursor.lastIndexOf("_"); const timestamp = cursor.slice(0, lastUnderscore); const id = cursor.slice(lastUnderscore + 1);
const time = Number.parseInt(timestamp, 36); if (Number.isNaN(time)) return null;
return { id, date: new Date(time) }; } catch { return null; }}