DateTimeField date operations - before, after, etc

24 views
Skip to first unread message

alexmnyc

unread,
Sep 6, 2013, 3:29:39 PM9/6/13
to rogue...@googlegroups.com
I have

object expires extends DateTimeField(this)


In rogue attempting to do the following

val expiry = Calendar.getInstance(); expiry.add(Calendar.MINUTE,30);

SocialUser.where(_.id eqs userObjectId)
                  .and(_.accessGrants elemMatch(_.expires before expiry))

yields 

value before is not a member of object x$6.expires


Any help is greatly appreciated.

Thank you.

Jorge Ortiz

unread,
Sep 6, 2013, 3:32:22 PM9/6/13
to rogue...@googlegroups.com
The argument to before needs to be a org.joda.time.DateTime (recommended) or a java.util.Date. We don't really support Calendar.


--
You received this message because you are subscribed to the Google Groups "rogue-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rogue-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

a.mik...@gmail.com

unread,
Sep 6, 2013, 3:37:41 PM9/6/13
to rogue...@googlegroups.com
Great. Thank you.
You received this message because you are subscribed to a topic in the Google Groups "rogue-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rogue-users/FbYrpiESptc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rogue-users...@googlegroups.com.

a.mik...@gmail.com

unread,
Sep 6, 2013, 3:41:33 PM9/6/13
to rogue...@googlegroups.com
Actually, it looks like there is a bug. It does not work still:
 
                val expiry = Calendar.getInstance(); expiry.add(Calendar.MINUTE,30);
                val expiryJoda= new org.joda.time.DateTime(expiry)
                val a = User.where(_.id eqs userObjectId)
                  .and(_.grants elemMatch(_.expires before expiryJoda)).fetch();
 
 value before is not a member of object x$6.expires
 
 

a.mik...@gmail.com

unread,
Sep 6, 2013, 3:54:55 PM9/6/13
to rogue...@googlegroups.com
Is the problem caused by definition of Record’s DateTimeField Calendar type?
 
class DateTimeField[OwnerType <: Record[OwnerType]](rec: OwnerType)
  extends Field[Calendar, OwnerType] with MandatoryTypedField[Calendar] with DateTimeTypedField
 
?

Tim Nelson

unread,
Sep 7, 2013, 8:02:33 AM9/7/13
to rogue...@googlegroups.com
Yes. Rogue does not support Calendar, so you need to use DateField instead of DateTimeField.

a.mik...@gmail.com

unread,
Sep 7, 2013, 6:19:37 PM9/7/13
to rogue...@googlegroups.com
Thanks for clarifying it, Tim. Much appreciated.
Reply all
Reply to author
Forward
0 new messages