| 1 | /* |
| 2 | * Copyright (c) 2024 sovity GmbH |
| 3 | * |
| 4 | * This program and the accompanying materials are made available under the |
| 5 | * terms of the Apache License, Version 2.0 which is available at |
| 6 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 7 | * |
| 8 | * SPDX-License-Identifier: Apache-2.0 |
| 9 | * |
| 10 | * Contributors: |
| 11 | * sovity GmbH - initial implementation |
| 12 | */ |
| 13 | import {Component, Input} from '@angular/core'; |
| 14 | |
| 15 | /** |
| 16 | * Displays a date as estimated relative time (e.g. "3 days ago"). |
| 17 | * |
| 18 | * But also shows the full date as a tooltip. |
| 19 | */ |
| 20 | @Component({ |
| 21 | selector: 'ago', |
| 22 | template: `<span [title]="date | date : 'EEEE yyyy-MM-dd hh:mm'">{{ |
| 23 | date | ago | async |
| 24 | }}</span>`, |
| 25 | }) |
| 26 | export class AgoComponent { |
| 27 | @Input() |
| 28 | date?: Date | null; |
| 29 | } |