This commit is contained in:
Adina Țeudan 2022-03-22 00:15:44 +02:00
parent 376b76648d
commit 4a4dc2ec78
2 changed files with 10 additions and 6 deletions

View File

@ -28,7 +28,11 @@ export abstract class BaseDialogComponent extends AutoUnsubscribe implements OnI
private readonly _dialogService: ConfirmationDialogService = this._injector.get(ConfirmationDialogService);
private readonly _dialog: MatDialog = this._injector.get(MatDialog);
constructor(protected readonly _injector: Injector, protected readonly _dialogRef: MatDialogRef<BaseDialogComponent>, private readonly _isInEditMode?: boolean) {
constructor(
protected readonly _injector: Injector,
protected readonly _dialogRef: MatDialogRef<BaseDialogComponent>,
private readonly _isInEditMode?: boolean,
) {
super();
}

View File

@ -1,7 +1,7 @@
import { ITrackable } from '../listing/models/trackable';
import moment from 'moment';
import { FormGroup } from '@angular/forms';
import { forOwn, has, isEqual, isPlainObject, transform } from 'lodash-es';
import dayjs, { Dayjs } from 'dayjs';
export function capitalize(value: string): string {
if (!value) {
@ -20,7 +20,7 @@ export function humanize(value: string, lowercase = true): string {
}
export function _log(value: unknown, message = '') {
console.log(`%c[${moment().format('HH:mm:ss.SSS')}] ${message}`, 'color: yellow;', value);
console.log(`%c[${dayjs().format('HH:mm:ss.SSS')}] ${message}`, 'color: yellow;', value);
}
export function toNumber(str: string): number {
@ -55,8 +55,8 @@ export function hasFormChanged(form: FormGroup, initialFormValue: Record<string,
if (JSON.stringify(initialValue) !== JSON.stringify(updatedValue)) {
return true;
}
} else if (updatedValue instanceof moment) {
if (!moment(updatedValue).isSame(moment(initialValue))) {
} else if (updatedValue instanceof dayjs) {
if (!(updatedValue as Dayjs).isSame(dayjs(initialValue))) {
return true;
}
} else {
@ -72,7 +72,7 @@ const HOURS_IN_A_DAY = 24;
const MINUTES_IN_AN_HOUR = 60;
export function getLeftDateTime(ISOString: string) {
const date = moment(ISOString);
const date = dayjs(ISOString);
const now = new Date(Date.now());
const daysLeft = date.diff(now, 'days');