Skip to content

Commit

Permalink
docs: update the README
Browse files Browse the repository at this point in the history
  • Loading branch information
gigadie committed Aug 14, 2019
1 parent 4790ced commit 5e40818
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,26 @@ Parses a custom-formatted date into a moment object that can be used with the ot

Prints `Last updated: January 24, 2016`

The pipe can also accept an array of formats as parameter.

``` typescript
@Component({
selector: 'app',
template: `
Last updated: {{'24/01/2014 22:00' | amParse: formats | amDateFormat:'LL'}}
`
})
export class App {

formats: ['DD/MM/YYYY HH:mm:ss', 'DD/MM/2016 HH:mm'];

constructor() { }

}
```

Prints `Last updated: January 24, 2016`

## amLocal pipe

Converts UTC time to local time.
Expand Down Expand Up @@ -291,6 +311,37 @@ Parses the date as UTC and enables mode for subsequent moment operations (such a

Prints `Last updated: 2017-01-01`

It's also possible to specify a different format than the standard ISO8601.

``` typescript
@Component({
selector: 'app',
template: `
Last updated: {{ '31/12/2016 23:00-01:00' | amFromUtc: 'DD/MM/2016 HH:mmZZ' | amDateFormat: 'YYYY-MM-DD' }}
`
})
```

Or even an array of formats:

``` typescript
@Component({
selector: 'app',
template: `
Last updated: {{ '31/12/2016 23:00-01:00' | amFromUtc: formats | amDateFormat: 'YYYY-MM-DD' }}
`
})
export class App {

formats: ['DD/MM/YYYY HH:mm:ss', 'DD/MM/2016 HH:mmZZ'];

constructor() { }

}
```

Both examples above will print `Last updated: 2017-01-01`

## amUtc pipe

Enables UTC mode for subsequent moment operations (such as displaying the time in UTC).
Expand Down

0 comments on commit 5e40818

Please sign in to comment.