Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amTimeAgo pipe returns "a few seconds ago" if the date property is missing #146

Open
iainbryden opened this issue May 26, 2017 · 0 comments

Comments

@iainbryden
Copy link

If the date property is missing amTimeAgo pipe returns "a few seconds ago"

The default date pipe just returns an empty string.

{{myItem.missingDate | date:'short' }}

Did you search for duplicate issue? Yes

Please describe the issue and steps to reproduce, preferably with a code sample / plunker:

export class MyClass {
    myItem = {name:'item'};
}

{{myItem.missingDate | amTimeAgo}}

output: 'a few seconds ago'

My work around is this:

<span  *ngIf="myItem?.missingDate">
    {{myItem.missingDate | amTimeAgo}}
</span>

Ensure your issue is isolated to angular2-moment. Issues involving third party tools will be closed unless submitted by the tool's author/maintainer.

Environment:
Windows 7

Please answer the following questions:

  • Angular version?
    @angular/cli: 1.0.0
    node: 7.2.0
    os: win32 x64
    @angular/common: 2.4.10
    @angular/compiler: 2.4.10
    @angular/core: 2.4.10
    @angular/forms: 2.4.10
    @angular/http: 2.4.10
    @angular/platform-browser: 2.4.
    @angular/platform-browser-dynam
    @angular/router: 3.4.10
    @angular/cli: 1.0.0
    @angular/compiler-cli: 2.4.10

  • TypeScript version?

  • moment version?
    1.3.3

  • Are you using moment-timezone?

  • Are you using the angular-cli?
    yes

  • Using Rollup/Webpack/System.js/Ionic/similar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant