1.3.2 • Published 5 years ago

ng-timespan v1.3.2

Weekly downloads
23
License
MIT
Repository
github
Last release
5 years ago

ng-timespan

codecov Build Status

Because there were just not a lot of good Typescript options out there for timespans. Intended to be used with Angular but can potentially be used for just about any JS/TS project.

Usage

Install from NPM

npm i ng-timespan --save

Import

import { Timespan } from 'ng-timespan'

Use

// Create a date
let date1 = new Date()

// Create a second date
let date2 = date1.setHours(date1.getHours() + 2)

// Create the Timespan
let timespan = TimeSpan.Subtract(date1, date2)

// Do stuff! :)
console.log(`Time till expiration: ${timespan.days} days, ${timespan.hours} hours, ${timespan.hours} minutes, ${timespan.seconds}`)
console.log(`Total Days: ${timespan.totalDays}`)
console.log(`Total Hours: ${timespan.totalHours}`)
console.log(`Total Minutes: ${timespan.totalMinutes}`)
console.log(`Total Seconds: ${timespan.totalSeconds}`)
console.log(`Total Milliseconds: ${timespan.totalMilliSeconds}`)

Contributing

  1. 🍴& ⬇️
  2. npm i
  3. Make a meaningful change
  4. npm run build to make sure everythng is working right
  5. Commit to your 🍴
  6. Open a PR explaining why the change is required.
1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.9.9

6 years ago

0.9.8

6 years ago

0.9.7

6 years ago

0.9.6

6 years ago

0.9.5

6 years ago

0.9.4

6 years ago

0.9.3

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.9.0

6 years ago