adding filters to my-listing (listingnumber), updated/new label
This commit is contained in:
@@ -148,7 +148,16 @@ export class BusinessListingsComponent implements OnInit, OnDestroy {
|
||||
if (!listing.location) return 'Location not specified';
|
||||
return `${listing.location.name}, ${listing.location.state}`;
|
||||
}
|
||||
private isWithinDays(date: Date | string | undefined | null, days: number): boolean {
|
||||
if (!date) return false;
|
||||
return dayjs().diff(dayjs(date), 'day') < days;
|
||||
}
|
||||
|
||||
getListingBadge(listing: BusinessListing): 'NEW' | 'UPDATED' | null {
|
||||
if (this.isWithinDays(listing.created, 14)) return 'NEW'; // Priorität
|
||||
if (this.isWithinDays(listing.updated, 14)) return 'UPDATED';
|
||||
return null;
|
||||
}
|
||||
navigateToDetails(listingId: string): void {
|
||||
this.router.navigate(['/details-business', listingId]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user