File size: 212 Bytes
8e944c6
 
 
 
 
1
2
3
4
5
6
export function hotScore(upvotes: number, createdAt: Date): number {
  const ageInHours =
    (Date.now() - createdAt.getTime()) / (1000 * 60 * 60);
  return Math.log10(Math.max(upvotes, 1)) - ageInHours / 24;
}