https://github.com/scalajs-io/moment-range
Fancy date ranges for Moment.js.
https://github.com/scalajs-io/moment-range
Last synced: 9 months ago
JSON representation
Fancy date ranges for Moment.js.
- Host: GitHub
- URL: https://github.com/scalajs-io/moment-range
- Owner: scalajs-io
- License: apache-2.0
- Created: 2017-03-17T06:54:10.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-17T23:09:57.000Z (over 6 years ago)
- Last Synced: 2025-01-17T22:42:30.760Z (11 months ago)
- Language: Scala
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
moment-range API for Scala.js
================================
[moment-range](https://www.npmjs.com/package/moment-range) - Fancy date ranges for Moment.js.
### Description
Fancy date ranges for Moment.js.
### Build Dependencies
* [SBT v1.2.x](http://www.scala-sbt.org/download.html)
### Build/publish the SDK locally
```bash
$ sbt clean publish-local
```
### Running the tests
Before running the tests the first time, you must ensure the npm packages are installed:
```bash
$ npm install
```
Then you can run the tests:
```bash
$ sbt test
```
### Examples
```scala
import io.scalajs.npm.moment._
import io.scalajs.npm.moment.range._
import scala.scalajs.js
val moment = MomentRange.extendMoment(Moment)
val start = new js.Date(2012, 4, 1)
val end = new js.Date(2012, 4, 23)
val lol = new js.Date(2012, 4, 15)
val wat = new js.Date(2012, 4, 27)
val range = moment.range(start, end)
val range2 = moment.range(lol, wat)
range.contains(lol) // true
range.contains(wat) // false
```
### Artifacts and Resolvers
To add the `moment-range` binding to your project, add the following to your build.sbt:
```sbt
libraryDependencies += "io.scalajs.npm" %%% "moment-range" % "0.5.0"
```
Optionally, you may add the Sonatype Repository resolver:
```sbt
resolvers += Resolver.sonatypeRepo("releases")