It should be working currently with more than Strings. The definition of
setFromAny is:

override def setFromAny(f : Any): Date = toDate(f).map(d =>
this.set(d)).openOr(this.is)

where toDate comes from net.liftweb.util.TimeHelpers:

  /** @return a Full(date) or a failure if the input couldn't be translated
to date (or Empty if the input is null)*/
  def toDate(in: Any): Box[Date] = {
    try {
      in match {
        case null => Empty
        case d: Date => Full(d)
        case lng: Long => Full(new Date(lng))
        case lng: Number => Full(new Date(lng.longValue))
        case Nil | Empty | None | Failure(_, _, _) => Empty
        case Full(v) => toDate(v)
        case Some(v) => toDate(v)
        case v :: vs => toDate(v)
        case s : String => tryo(internetDateFormatter.parse(s)) or
tryo(dateFormatter.parse(s))
        case o => toDate(o.toString)
      }
    } catch {
      case e => Log.debug("Error parsing date "+in, e); Failure("Bad date:
"+in, Full(e), Empty)
    }
  }

Is it not working for you?

On Wed, Sep 9, 2009 at 3:31 AM, Jeppe Nejsum Madsen <[email protected]>wrote:

>
> Hi,
>
> Is there a reason why MappedDate.setFromAny only works with Strings?
>
> It would seem natural to also accept Date, Calendar and maybe long (in
> ms)??
>
> /Jeppe
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to