Maximus upgradus
This commit is contained in:
+16
-6
@@ -5,11 +5,17 @@ export function formatResetCountdown(resetAtSeconds: number): string {
|
||||
if (diffSeconds <= 0) return "resetting now";
|
||||
if (diffSeconds < 60) return "resets in <1m";
|
||||
|
||||
const hours = Math.floor(diffSeconds / 3600);
|
||||
const totalHours = Math.floor(diffSeconds / 3600);
|
||||
const minutes = Math.floor((diffSeconds % 3600) / 60);
|
||||
|
||||
if (hours > 0 && minutes > 0) return `resets in ${hours}h ${minutes}m`;
|
||||
if (hours > 0) return `resets in ${hours}h`;
|
||||
if (totalHours >= 24) {
|
||||
const days = Math.floor(totalHours / 24);
|
||||
const hours = totalHours % 24;
|
||||
if (hours > 0) return `resets in ${days}d ${hours}h`;
|
||||
return `resets in ${days}d`;
|
||||
}
|
||||
if (totalHours > 0 && minutes > 0) return `resets in ${totalHours}h ${minutes}m`;
|
||||
if (totalHours > 0) return `resets in ${totalHours}h`;
|
||||
return `resets in ${minutes}m`;
|
||||
}
|
||||
|
||||
@@ -19,7 +25,11 @@ export function formatResetCountdownISO(isoString: string): string {
|
||||
}
|
||||
|
||||
export function windowLabel(limitWindowSeconds: number): string {
|
||||
if (limitWindowSeconds <= 3600) return "1h window";
|
||||
if (limitWindowSeconds <= 86400) return "24h window";
|
||||
return `${Math.round(limitWindowSeconds / 3600)}h window`;
|
||||
const hours = limitWindowSeconds / 3600;
|
||||
if (hours < 24) return `${Math.round(hours)}h`;
|
||||
const days = hours / 24;
|
||||
const wholeDays = Math.floor(days);
|
||||
const remainderHours = Math.round(hours - wholeDays * 24);
|
||||
if (remainderHours === 0) return `${wholeDays}d`;
|
||||
return `${wholeDays}d ${remainderHours}h`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user