* Gets human-readable time remaining
()
| 383 | * Gets human-readable time remaining |
| 384 | */ |
| 385 | private getTimeRemaining(): string { |
| 386 | const remaining = Math.max(0, this.expiresAt - Date.now()); |
| 387 | const minutes = Math.floor(remaining / 60000); |
| 388 | const seconds = Math.floor((remaining % 60000) / 1000); |
| 389 | |
| 390 | if (minutes > 0) { |
| 391 | return this.translate("modals.deviceCode.expiresMinutesSeconds", { minutes, seconds }); |
| 392 | } else { |
| 393 | return this.translate("modals.deviceCode.expiresSeconds", { seconds }); |
| 394 | } |
| 395 | } |
| 396 | } |