Angular Pipe for converting hours in days and hours

The below code is helpful for you when you want to show the hours in working days and hours.

import { PipeTransform, Pipe } from '@angular/core';
 
@Pipe({
    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);
         if(hour){
             return days+ 'd ' + hour + 'h';
         } else{
            return days  + 'd';
         }
 
      }
 
  }

Create custom pipes 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.