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'; | |
@Pipe({ | |
name: 'convert' | |
}) | |
export class HoursToMin implements PipeTransform { | |
transform(value: string): any { | |
const d = Number(value || 0) * 3600; | |
const h = Math.floor(d / 3600); | |
const m = Math.floor(d % 3600 / 60); |
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 utils from '../utils/utils'; | |
@Pipe({ | |
name: 'simpleAgo' | |
}) | |
export class DateConvert implements PipeTransform { | |
transform(date: string): any { | |
// console.log('date in the pipe:', date); | |
let time = Number(date); | |
if ( time < 1000000000000) { |
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 utils from '../utils/utils'; | |
@Pipe({ | |
name: 'simpleAgo' | |
}) | |
export class SimpleAgo implements PipeTransform { | |
transform(date: string): any { | |
let time = Number(date); | |
if ( time < 1000000000000) { | |
time = time * 1000; |
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 { Directive, HostListener, ElementRef, OnInit } from '@angular/core'; | |
@Directive({ selector: '[InputValidator]' }) | |
export class InputValidatorDirective implements OnInit { | |
el: any; | |
constructor(private elementRef: ElementRef) { | |
this.el = this.elementRef.nativeElement; | |
} |
NewerOlder