fix typing

This commit is contained in:
Dan Percic 2022-03-09 11:20:29 +02:00
parent f6c134a167
commit c892507798
5 changed files with 6 additions and 30 deletions

View File

@ -3,6 +3,7 @@ import {
CircleButtonTypes,
ConfirmationDialogInput,
DefaultListingServices,
getLeftDateTime,
IListable,
ListingComponent,
LoadingService,
@ -17,7 +18,6 @@ import { AdminDialogService } from '../../services/admin-dialog.service';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { Observable } from 'rxjs';
import { distinctUntilChanged, map } from 'rxjs/operators';
import { getLeftDateTime } from '@utils/functions';
import { RouterHistoryService } from '@services/router-history.service';
import { IDossier } from '@red/domain';
import { PermissionsService } from '@services/permissions.service';

View File

@ -5,6 +5,7 @@ import {
CircleButtonTypes,
ConfirmationDialogInput,
DefaultListingServices,
getLeftDateTime,
IListable,
ListingComponent,
LoadingService,
@ -15,7 +16,6 @@ import {
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import * as moment from 'moment';
import { ConfigService } from '@services/config.service';
import { getLeftDateTime } from '@utils/functions';
import { firstValueFrom, Observable, of } from 'rxjs';
import { distinctUntilChanged, map } from 'rxjs/operators';
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';

View File

@ -3,7 +3,7 @@ import * as moment from 'moment';
import { TranslateService } from '@ngx-translate/core';
import { DatePipe as BaseDatePipe } from '@angular/common';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { getLeftDateTime } from '@utils/functions';
import { getLeftDateTime } from '@iqser/common-ui';
const MONTH_NAMES = {
0: _('months.jan'),

View File

@ -1,12 +1,4 @@
import * as moment from 'moment';
import { List } from '@iqser/common-ui';
import { filter } from 'rxjs/operators';
import { ActivationEnd } from '@angular/router';
import { BaseScreenComponent } from '@components/base-screen/base-screen.component';
export const currentComponentRoute = filter(
event => event instanceof ActivationEnd && !!event.snapshot.component && event.snapshot.component !== BaseScreenComponent,
);
export function groupBy(xs: List<unknown>, key: string) {
return xs.reduce((rv, x) => {
@ -15,7 +7,7 @@ export function groupBy(xs: List<unknown>, key: string) {
}, {});
}
export function hexToRgb(hex) {
export function hexToRgb(hex: string) {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result
? {
@ -26,7 +18,7 @@ export function hexToRgb(hex) {
: null;
}
export function getFirstRelevantTextPart(text, direction: 'FORWARD' | 'BACKWARD') {
export function getFirstRelevantTextPart(text: string, direction: 'FORWARD' | 'BACKWARD') {
let spaceCount = 0;
let accumulator = '';
const breakChars = [':', ' '];
@ -76,22 +68,6 @@ export function toNumber(str: string) {
}
}
const HOURS_IN_A_DAY = 24;
const MINUTES_IN_AN_HOUR = 60;
export function getLeftDateTime(ISOString: string) {
const date = moment(ISOString);
const now = new Date(Date.now());
const daysLeft = date.diff(now, 'days');
const hoursFromNow = date.diff(now, 'hours');
const hoursLeft = hoursFromNow - HOURS_IN_A_DAY * daysLeft;
const minutesFromNow = date.diff(now, 'minutes');
const minutesLeft = minutesFromNow - HOURS_IN_A_DAY * MINUTES_IN_AN_HOUR * daysLeft;
return { daysLeft, hoursLeft, minutesLeft };
}
export function removeBraces(str: any): string {
return str.replace(/[{}]/g, '');
}

@ -1 +1 @@
Subproject commit 903a6288deb66d865974a13bd03adf27c73070a2
Subproject commit a6c4093d3553c4d0f95e496678e2a8f1cab0b9de