add isToday function
This commit is contained in:
parent
b8c3b76e56
commit
9891c2bf67
@ -16,5 +16,4 @@ const components = [ChevronButtonComponent, CircleButtonComponent, IconButtonCom
|
|||||||
imports: [CommonModule, IqserIconsModule, TranslateModule, ...matModules],
|
imports: [CommonModule, IqserIconsModule, TranslateModule, ...matModules],
|
||||||
exports: [...components],
|
exports: [...components],
|
||||||
})
|
})
|
||||||
export class IqserButtonsModule {
|
export class IqserButtonsModule {}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Id, ITrackable } from '../listing';
|
import type { Id, ITrackable } from '../listing';
|
||||||
import { UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormGroup } from '@angular/forms';
|
||||||
import { forOwn, has, isEqual, isPlainObject, transform } from 'lodash-es';
|
import { forOwn, has, isEqual, isPlainObject, transform } from 'lodash-es';
|
||||||
import dayjs, { Dayjs } from 'dayjs';
|
import dayjs, { type Dayjs } from 'dayjs';
|
||||||
import { inject } from '@angular/core';
|
import { inject } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
@ -81,6 +81,10 @@ export function isJustOne<T>(list: T[]): list is [T] {
|
|||||||
return list.length === 1;
|
return list.length === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isToday(date: string | Date | Dayjs) {
|
||||||
|
return dayjs(date).isSame(new Date(), 'day');
|
||||||
|
}
|
||||||
|
|
||||||
export function trackByFactory<T extends ITrackable<PrimaryKey>, PrimaryKey extends Id = T['id']>() {
|
export function trackByFactory<T extends ITrackable<PrimaryKey>, PrimaryKey extends Id = T['id']>() {
|
||||||
return (_index: number, item: T): Id => item.id;
|
return (_index: number, item: T): Id => item.id;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user