1.2.0 • Published 6 years ago

date-async-format-pipe v1.2.0

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
6 years ago

DateAsyncFormatPipe

Pipe to format date with async format retrival. E.g. this can be helpful when using ng2-translate

Date is formated with moment.js

How to use

Module import

import { DateAsyncFormatModule } from "date-async-format-pipe";

@NgModule({
    imports: [
        DateAsyncFormatModule
    ]
})
export class SomeModule {
}

template

date | dateFormatAsync : format

Where

  • date: any valid date input for moment.js.
  • format: Observable<string> that resolves with valid moment.js format patterns.

Example

@Component({
  template: `<div>{{ date | dateFormatAsync : dateFormat$ }}</div> `
})
class SomeComponent {
  public date: Date;
  public dateFormat$: Observable<string>;

  constructor(private translate: TranslateService) {
    this.date = new Date();
    this.dateFormat$ = translate.get("TIME_SHORT")
  }
}
1.2.0

6 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago