Feature/refactor to format distance to now strict (#133)
* Change from formatDistanceToNow to formatDistanceToNowStrict * Update changelog
This commit is contained in:
parent
ec046b81a7
commit
b021fbde59
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Respected the data source attribute of the transactions model in the data management for historical data
|
- Respected the data source attribute of the transactions model in the data management for historical data
|
||||||
- Prettified the generic scraper symbols in the transaction filtering component
|
- Prettified the generic scraper symbols in the transaction filtering component
|
||||||
|
- Changed to the strict mode of distance formatting between two given dates
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import { DataService } from '@ghostfolio/client/services/data.service';
|
|||||||
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
import { UserService } from '@ghostfolio/client/services/user/user.service';
|
||||||
import { DEFAULT_DATE_FORMAT } from '@ghostfolio/common/config';
|
import { DEFAULT_DATE_FORMAT } from '@ghostfolio/common/config';
|
||||||
import { AdminData, User } from '@ghostfolio/common/interfaces';
|
import { AdminData, User } from '@ghostfolio/common/interfaces';
|
||||||
import { formatDistanceToNow, isValid, parseISO, sub } from 'date-fns';
|
import { formatDistanceToNowStrict, isValid, parseISO, sub } from 'date-fns';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ export class AdminPageComponent implements OnInit {
|
|||||||
|
|
||||||
public formatDistanceToNow(aDateString: string) {
|
public formatDistanceToNow(aDateString: string) {
|
||||||
if (aDateString) {
|
if (aDateString) {
|
||||||
const distanceString = formatDistanceToNow(
|
const distanceString = formatDistanceToNowStrict(
|
||||||
sub(parseISO(aDateString), { seconds: 10 }),
|
sub(parseISO(aDateString), { seconds: 10 }),
|
||||||
{
|
{
|
||||||
addSuffix: true
|
addSuffix: true
|
||||||
@ -124,7 +124,7 @@ export class AdminPageComponent implements OnInit {
|
|||||||
this.users = users;
|
this.users = users;
|
||||||
|
|
||||||
if (isValid(parseISO(lastDataGathering?.toString()))) {
|
if (isValid(parseISO(lastDataGathering?.toString()))) {
|
||||||
this.lastDataGathering = formatDistanceToNow(
|
this.lastDataGathering = formatDistanceToNowStrict(
|
||||||
new Date(lastDataGathering),
|
new Date(lastDataGathering),
|
||||||
{
|
{
|
||||||
addSuffix: true
|
addSuffix: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user