Bugfix/fix last activity column (#158)

* Fix last activity (only values in the past)

* Update changelog
pull/159/head
Thomas 4 years ago committed by GitHub
parent 8314b98f81
commit c519eb0e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Cleaned up the analysis page with an unused chart module
- Improved the cell alignment in the users table of the admin control panel
### Fixed
- Fixed the last activity column of users in the admin control panel
## 1.14.0 - 09.06.2021
### Added

@ -5,7 +5,12 @@ import { DataService } from '@ghostfolio/client/services/data.service';
import { UserService } from '@ghostfolio/client/services/user/user.service';
import { DEFAULT_DATE_FORMAT } from '@ghostfolio/common/config';
import { AdminData, User } from '@ghostfolio/common/interfaces';
import { formatDistanceToNowStrict, isValid, parseISO } from 'date-fns';
import {
differenceInSeconds,
formatDistanceToNowStrict,
isValid,
parseISO
} from 'date-fns';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@ -80,8 +85,8 @@ export class AdminPageComponent implements OnInit {
addSuffix: true
});
return distanceString === 'in 0 seconds' ||
distanceString === '0 seconds ago'
return Math.abs(differenceInSeconds(parseISO(aDateString), new Date())) <
60
? 'just now'
: distanceString;
}

Loading…
Cancel
Save