Ionic RC - Great Angular 2 pipe 'timeAgo'
<p>There is a great pipe posted on <a href="https://stackoverflow.com/questions/36663148/angular-2-time-ago-pipe">here</a>. </p>

<p>I'm trying to make it work with Ionic 2 RC version and getting these three errors:</p>

<ol>
<li>Type 'any' is not a constructor function type</li>
<li>Cannot find name 'ChangeDetectorRef'. Parameter 'ref' of constructor from exported class has or is using private name 'ChangeDetectorRef'.</li>
<li><p>Property 'interval' does not exist on type 'typeof Observable'</p>

<pre><code>import {Pipe, ChangeDetectorRef} from 'angular2/core';
import {Observable} from 'rxjs/Observable';
import {AsyncPipe} from 'angular2/common';


@Pipe({
    name: 'messageTime',
    pure: false
})
export class MessageTimePipe extends AsyncPipe {  //Type 'any' is not a constructor function type
    value:Date;
    timer:Observable&lt;string&gt;;

constructor(ref:ChangeDetectorRef) {  //Cannot find name 'ChangeDetectorRef'. Parameter 'ref' of constructor from exported class has or is using private name 'ChangeDetectorRef'.
    super(ref);
}

transform(obj:any, args?:any[]):any {
    if (obj instanceof Date) {
        this.value = obj;

        if(!this.timer) {
                this.timer = this.getObservable();
        }

        return super.transform(this.timer, args);
    }

    return super.transform(obj, args);
}

private getObservable() {
    return Observable.interval(1000).startWith(0).map( () =&gt; {  //Property 'interval' does not exist on type 'typeof Observable'
        var result:string;
        // current time
        let now = new Date().getTime();

        // time since message was sent in seconds
        let delta = (now - this.value.getTime()) / 1000;

        // format string
        if (delta &lt; 10) {
            result = 'jetzt';
        }
        else if (delta &lt; 60) { 
            // sent in last minute
            result = 'vor ' + Math.floor(delta) + ' Sekunden';
        }
        else if (delta &lt; 3600) { 
            // sent in last hour
            result = 'vor ' + Math.floor(delta / 60) + ' Minuten';
        }
        else if (delta &lt; 86400) { 
            // sent on last day
            result = 'vor ' + Math.floor(delta / 3600) + ' Stunden';
        }
        else { 
            // sent more than one day ago
            result = 'vor ' + Math.floor(delta / 86400) + ' Tagen';
        }
        return result;
    });
};
</code></pre>

<p>}</p></li>
</ol>

<p>Any idea on how to solve this?</p>

<p>Edit: I was able to take out error 3/ by using <code>import {Observable} from 'rxjs/Rx';</code></p>