@alheimsins/uker-fra-dato
Version:
Count weeks from a given date
34 lines (21 loc) • 845 B
Markdown
[](https://github.com/feross/standard)
# uker-fra-dato
Count weeks from a given date or between two dates.
Returns 0 for end date in the past.
Does only calculate from date and not time.
# Usage
```JavaScript
const wfd = require('@alheimsins/uker-fra-dato')
const start = new Date('2020-09-07')
const endOne = new Date('2020-09-13')
const endTwo = new Date('2020-09-14')
const endPast = new Date('2019-05-01')
console.log(wfd(start, endOne)) //=> 0
console.log(wfd(start, endTwo)) // => 1
console.log(wfd(start, endPast)) // => 0
```
# License
[MIT](LICENSE)
## About
Created with ❤ for [Alheimsins](https://alheimsins.net)
<img src="https://image.ibb.co/dPH08G/logo_black.png" alt="Alheimsins logo" height="150px" width="150px" />