Fix date sorting
This commit is contained in:
		
							parent
							
								
									8bd4fce5f1
								
							
						
					
					
						commit
						51f1ce3a53
					
				@ -296,7 +296,7 @@ async function getLeaderboardEntries() {
 | 
				
			|||||||
        let dateLastBeat = new Date();
 | 
					        let dateLastBeat = new Date();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (count > 0) {
 | 
					        if (count > 0) {
 | 
				
			||||||
            const lastGame = games.at(-1);
 | 
					            const lastGame = games[games.length - 1];
 | 
				
			||||||
            dateLastBeat = lastGame.statusLastChanged;
 | 
					            dateLastBeat = lastGame.statusLastChanged;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -310,8 +310,8 @@ async function getLeaderboardEntries() {
 | 
				
			|||||||
        results.push(result);
 | 
					        results.push(result);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await results.sort((a, b) => parseInt(a.dateLastBeat) - parseInt(b.dateLastBeat));
 | 
					    results.sort((a, b) => new Date(a.dateLastBeat) - new Date(b.dateLastBeat));
 | 
				
			||||||
    await results.sort((a, b) => parseInt(b.count) - parseInt(a.count));
 | 
					    results.sort((a, b) => parseInt(b.count) - parseInt(a.count));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return results;
 | 
					    return results;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -333,7 +333,7 @@ async function getLeaderboardEntriesBetweenDates(start, end) {
 | 
				
			|||||||
        let dateLastBeat = new Date();
 | 
					        let dateLastBeat = new Date();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (count > 0) {
 | 
					        if (count > 0) {
 | 
				
			||||||
            const lastGame = games.at(-1);
 | 
					            const lastGame = games[games.length - 1];
 | 
				
			||||||
            dateLastBeat = lastGame.statusLastChanged;
 | 
					            dateLastBeat = lastGame.statusLastChanged;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -347,8 +347,8 @@ async function getLeaderboardEntriesBetweenDates(start, end) {
 | 
				
			|||||||
        results.push(result);
 | 
					        results.push(result);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await results.sort((a, b) => parseInt(a.dateLastBeat) - parseInt(b.dateLastBeat));
 | 
					    results.sort((a, b) => new Date(a.dateLastBeat) - new Date(b.dateLastBeat));
 | 
				
			||||||
    await results.sort((a, b) => parseInt(b.count) - parseInt(a.count));
 | 
					    results.sort((a, b) => parseInt(b.count) - parseInt(a.count));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return results;
 | 
					    return results;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user