GithubHelp home page GithubHelp logo

ng-luxon-duration's Introduction

ng-luxon-duration

Pipes for use and format Luxon Duration in Angular (2+)


Installation

Node.js

npm install ng-luxon-duration

Usage

Import LuxonDurationModule into your app's modules:

import { LuxonDurationModule } from 'ng-luxon-duration';

@NgModule({
  imports: [
    LuxonDurationModule
  ]
})

This makes all the ng-luxon-duration pipes available for use in your app components.

Available pipes

aldFromISO pipe

Create a Duration from an ISO 8601 duration string. Accepts same optional opts parameter as Duration.fromISO.

Example:

@Component({
  selector: 'app',
  template: `
    Last updated: {{myISODuration | aldFromISO | aldToFormat:'hh:mm:ss' }}
  `
})

aldFromMillis pipe

Create a Duration from a number of milliseconds. Accepts same optional opts parameter as Duration.fromMillis.

Example:

@Component({
  selector: 'app',
  template: `
    Last updated: {{millis | aldFromMillis | aldToFormat:'hh:mm:ss' }}
  `
})

aldFromObject pipe

Create a Duration from a Javascript object with keys like 'years' and 'hours'. See Duration.fromObject for more details about the keys and the accepted options.

Example:

@Component({
  selector: 'app',
  template: `
    Last updated: {{myDurationObject | aldFromObject | aldToFormat:'hh:mm:ss' }}
  `
})

aldToFormat pipe

Returns a string representation of this Duration formatted according to the specified format string. Accepts same optional opts parameter as Duration.fromISO.

Example:

@Component({
  selector: 'app',
  template: `
    Last updated: {{myISODuration | aldFromISO | aldToFormat:'hh:mm:ss' }}
  `
})

aldToISO pipe

Returns an ISO 8601-compliant string representation of this Duration.

Example:

@Component({
  selector: 'app',
  template: `
    Last updated: {{myISODuration | aldFromISO | aldToISO }}
  `
})

License

Released under the terms of the MIT License.

ng-luxon-duration's People

Contributors

vin-car avatar dependabot[bot] avatar

Stargazers

Miran avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.