import {Pipe, PipeTransform} from '@angular/core';

@Pipe({
  name: 'quarter',
})
//FIXME: There is a bug which causes values like 2016.75 to be returned as 2016 Q1.2 instead of 2016 Q3
export class QuarterPipe implements PipeTransform {
  transform(value: any, ...args: any[]): any {
    const [year, quarter] = value.split('.');
    return `${year} Q${(quarter / 100) * 4 + 1}`;
  }
}
