Skip to content

Instantly share code, notes, and snippets.

@wickdninja
Last active September 24, 2021 15:02
Show Gist options
  • Save wickdninja/b89746e41eab7e5ee250a38f337736a3 to your computer and use it in GitHub Desktop.
Save wickdninja/b89746e41eab7e5ee250a38f337736a3 to your computer and use it in GitHub Desktop.
angular wrapper for date-fns DistanceInWordsToNow function
import { Pipe, PipeTransform } from '@angular/core';
import { distanceInWordsToNow } from 'date-fns';
@Pipe({
name: 'distanceInWordsToNow',
pure: false
})
export class DistanceInWordsToNowPipe implements PipeTransform {
transform(value: string) {
return distanceInWordsToNow(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment