Comments (4)
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import com.github.nscala_time.time.Implicits._
import com.github.nscala_time.time.Implicits._
scala> new org.joda.time.Interval(0, 1)
res0: org.joda.time.Interval = 1970-01-01T09:00:00.000+09:00/1970-01-01T09:00:00.001+09:00
scala> res0.toDuration.toScalaDuration
res1: scala.concurrent.duration.Duration = 1 millisecond
from nscala-time.
That doesn't quite get me there, as the API I'm trying to use requires FiniteDuration
.
Right now, I'm using time => (DateTime.now() to time).toDurationMillis.millis
, with import scala.concurrent.duration._
to get the unit methods. It feels like there should be a way to just drop in the interval I want where w FiniteDuration
is expected. Would it be undesirable for this implicit conversion to exist?
from nscala-time.
toScalaDuration
will return FiniteDuration since the next version. https://github.com/nscala-time/nscala-time/pull/106/files
Is it sufficient for you?
from nscala-time.
That helps out, but it would be useful to have that on Interval
too. With toScalaDuration
, it still looks like time => (DateTime.now() to time).toDuration.toScalaDuration
, which seems overly verbose for what it's trying to accomplish.
from nscala-time.
Related Issues (20)
- Latest Version publish HOT 1
- Drop Scala 2.9.3 support in newer version HOT 1
- max min to DateTime HOT 3
- Add support for multiplication of constant with duration HOT 1
- Check if date is within time range
- RichLong is missing timezone-aware helpers
- Release for Scala 2.12.0 HOT 1
- Possible improvement: DateTime + FiniteDuration syntax
- Get weird result when I want to find period between two dates and subtract some date by it HOT 1
- Release with the latest joda HOT 1
- API changes report for Nscala Time
- Unexpected behaviour with setting DateTime to Midnight HOT 2
- Possible improvement: add the ability to exclude the end of the interval when splitting by period
- Where can I find current release notes?
- Reasons behind now() change? HOT 1
- What do you think about implicit toDateTime over long HOT 1
- New released needed for JDK 1.8u60 HOT 2
- Migrate to java.time HOT 1
- support for min / max operations HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nscala-time.