OK, this is different than the code I originally wrote. In 1.0.1 it's this:

http://github.com/dpp/liftweb/blob/aec338c97648ea700de7a14b495b8be6b374153b/lift-mapper/src/main/scala/net/liftweb/mapper/MappedDate.scala

I'm not sure who made that change, but I think that we want something in the
middle: full support for a variety of types but with user-customizable
parsing. I think what we really want is the original code, but changing the
toDate to a overridable def on the Field itself. Something like:

class MappedDate ... {
  ...
  def parseDate(s : String) : Box[Date] = Helpers.toDate(s)

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

Then you could provide your own if needed:

object StartDate extends MappedDate(this) {
  override parseDate(s: String) : Box[Date] = ...
}

Thoughts?

Derek

On Wed, Sep 9, 2009 at 2:01 PM, Jeppe Nejsum Madsen <[email protected]>wrote:

>
> Derek Chen-Becker <[email protected]> writes:
>
> > 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)
>
> This, I think, is from MappedTime. MappedDate (& MappedDateTime) is:
>
> override def setFromAny(f : Any): Date = f match {
>    case s: String => LiftRules.parseDate(s).map(d => this.set(d)).openOr(
> this.is)
>    case (s: String) :: _ => LiftRules.parseDate(s).map(d =>
> this.set(d)).openOr(this.is)
>    case _ => this.is
> }
>
> > Is it not working for you?
>
> I think it would if it was in MappedDate ;-)
>
> /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