jorgeortiz85 / scala-time Goto Github PK
View Code? Open in Web Editor NEWA Scala wrapper for Joda Time
License: Apache License 2.0
A Scala wrapper for Joda Time
License: Apache License 2.0
When importing
import org.scala_tools.time.Imports._
and using LocalDateTime.parse..., the parse method is not available. I can add this method definition to the StaticLocalDateTime.scala file for me, but it would be better to check other methods and classes in the main repository.
Thank you.
Recent addition to Scala 2.8pre is the SeqLike.sortBy method which allows you to say
listOfPerson.sortBy(person => person.name)
listOfPerson.sortBy(person => person.shoeSize)
listOfPerson.sortBy(person => person.salary)
but not currently
listOfPerson.sortBy(person => person.dob)
The String/Int/Double sorts works because of implicit object definitions in Ordering.scala. See http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/library/scala/Ordering.scala?view=markup from "trait FloatOrdering extends Ordering[Float]".
Suggestion: Add similar implicit objects to Scala-Time in the same style os those in Ordering.scala
For example:
trait DateTimeOrdering extends Ordering[DateTime] {
def compare(x: DateTime, y: DateTime) = x.compareTo(y)
}
implicit object DateTime extends DateTime Ordering
Simple example of usage shown at end of http://quoiquilensoit.blogspot.com/2009/11/c-linq-orderby-scala-sortwith-and.html
Hi,
I just tried to clone the project and run sbt build. I'm getting:
warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.jsuereth#xsbt-gpg-plugin;0.6: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.jsuereth:xsbt-gpg-plugin:0.6 (scalaVersion=2.10, sbtVersion=0.13)
[warn]
sbt.ResolveException: unresolved dependency: com.jsuereth#xsbt-gpg-plugin;0.6: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:217)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:126)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:125)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:115)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:115)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:103)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:48)
at sbt.IvySbt$$anon$3.call(Ivy.scala:57)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:98)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:81)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102)
at xsbt.boot.Using$.withResource(Using.scala:11)
at xsbt.boot.Using$.apply(Using.scala:10)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:57)
at sbt.IvySbt.withIvy(Ivy.scala:98)
at sbt.IvySbt.withIvy(Ivy.scala:94)
at sbt.IvySbt$Module.withModule(Ivy.scala:115)
at sbt.IvyActions$.update(IvyActions.scala:125)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1223)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1221)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$74.apply(Defaults.scala:1244)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$74.apply(Defaults.scala:1242)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1246)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1241)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1249)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1214)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1192)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Any idea?
If GenericRange becomes non experimental in Scala 2.8, then it should be possible to implement:
for (d <- DateTime.now to DateTime.now + 1.month by 1 week)
I cloned the repo, and did mvn clean package. This gives an error on getChronology on DateTimeFormatter of Joda. This method is not present in Joda 1.6. Changing the version of the Joda dependency in pom.xml to 1.6.2 fixes this.
Hi,
any chance you could build against 2.9.2 as well?
Thanks,
Channing
When using an int conversion from IntImplicits, for instance 2.days in the context of a specs2 test, the implicit conversion from Int to DateTime conflicts with the one from specs2's TimeConversion, giving the following compilation error:
error: type mismatch;
found : Int(2)
required: ?{val days: ?}
Note that implicit conversions are not applicable because they are ambiguous:
both method RichInt in trait IntImplicits of type (n: Int)org.scala_tools.time.RichInt
and method intToRichLong in trait TimeConversions of type (v: Int)MongoMetaSiteDaoTest.this.RichLong
are possible conversion functions from Int(2) to ?{val days: ?}
Error occurred in an application involving default arguments.
val site1 = MetaSite(originTemplateId = new ObjectId().toString, ownerUserId = user, name = "site1", dateUpdated = DateTime.now + 2.days)
Not that I have an idea how to solve this but it's a bug nonetheless :)
Instead of
DateTimeFormat.shortDate().print(dateOfBirth)
It would be nice to write
dateOfBirth.toShortDateString()
or
dateOfBirth.toString("yyyy-MM-dd")
Hello,
I've just found a problem with the toDateTime method of the DateMidnight object:
this works
new DateTime() + 1.day toDate()
this works too
new DateMidnight() + 1.day - 1.millis
this works not
new DateMidnight() + 1.day toDateTime() - 1.millis
==> value - is not a member of Unit
Thank you
This is organizational issue -- could you please provide the package the same way Joda is provided -- jars, sources, etc. I know each user can make those by him/herself but it would be useful to have it "officially".
Thank you.
import org.scala_tools.time.Imports._
is no longer working, anyone know where the latest version is at?
Does this library work with Scala 2.9.0.1? If so, mind re-publishing the artifacts for newer versions of Scala? Thanks!
scala-tools.org is going away in June, time to rename this to org.scala-lang or something like that...
I think now that Scala 2.8.0 is released, a lot of people will stick to it for a while. So it would be very useful to have a Scala 2.8.0 binary of scala-time in Maven Central.
Class DurationBuilder is not accessible but it is useful in many occasions. I.e. I would like to create methods like
def f(db: DurationBuilder) = ... do something
and use it like f(1.second + 50.millis)
If I use it right now I get:
class DurationBuilder in package time cannot be accessed in package org.scala_tools.time
Can this class be made public?
Any plans for this?
Sayeth the homepage:
Version 2.0 is almost completely source and binary compatible with version 1.x. Key changes include the use of JDK 1.5 or later, generics, and the removal of some (but not all) deprecated methods. See the upgrade notes for full details including information on the corner cases that are not compatible. Applications should be able to drop version 2.0 in place of an earlier version without any issues providing they are using JDK 1.5 or later and are not using one of the deprecated methods. Please let us know if a corner case hits you, especially if Joda-Time is a dependency of another open source project.
I only ask because I can't seem to find the javadocs for 1.6 online. :/
Final Scala 2.10 was published a while ago, it could be nice to have scala-time compiled for it on maven repositories.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.