Created
March 15, 2023 13:43
-
-
Save umutyerebakmaz/485d9401c0bd41e973abfef875c8d2a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
import * as moment from 'moment'; | |
import 'moment/locale/tr'; | |
@Pipe({ | |
name: 'humanReadableDate', | |
}) | |
export class HumanReadableDatePipe implements PipeTransform { | |
transform(date: Date) { | |
const now = moment(); | |
let future = moment(new Date(date)); | |
return moment.duration(future.diff(now)).humanize(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment