Angular Pipe for converting hours in days and hours using custom pipe

The below code is helpful for you when you want to show the hours in working days and hours in Angular using Angular pipe.
In the below we are creating a custom pipe to encapsulate transformations that are not provided with the built-in pipes. You can then use your custom pipe in template expressions, the same way you use built-in pipes—to transform input values to output values for display.

import { PipeTransform, Pipe } from '@angular/core';
    name: 'dayhour'
  export class DayHourPipe implements PipeTransform {
      transform(value: number): string {
         const days: number = Math.floor(value / 8);
         const hour = Math.floor(value - days * 8);
             return days+ 'd ' + hour + 'h';
         } else{
            return days  + 'd';

Here we have given ‘Day Hour’ in the name property in the @pipe decoration. Below we have defined our class which inherits from transport interface. Angular invokes the transform method with the value of a binding as the first argument. In the method we did a simple calculation to calculate the days and hours.
You can also change the above calculation to find out the days, hours and minutes.