Skip to content

Commit

Permalink
feat: limit uptime display if longer than 30 days (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilczaja authored Jun 3, 2024
1 parent 6c13873 commit 2c0bacf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ please see [changelog_updates.md](docs/dev/changelog_updates.md).

#### Patch

- Component uptime now displays up to '30+ days' [#211](https://github.com/sovity/authority-portal/issues/211)

### Known issues

### Deployment Migration Notes
Expand Down
3 changes: 3 additions & 0 deletions authority-portal-frontend/src/app/core/utils/time-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export function toDays(seconds: number): number {
export function humanizeDuration(seconds: number): string {
const days = toDays(seconds);
if (days >= 1) {
if (days > 30) {
return '30+ days'
}
return `${days.toFixed(0)} ${days === 1 ? 'day' : 'days'}`;
}

Expand Down

0 comments on commit 2c0bacf

Please sign in to comment.