Using DateTimeConverter

14 views
Skip to first unread message

Colin Bester

unread,
Nov 29, 2016, 6:41:30 AM11/29/16
to Lift
What is correct way to use DateTimeConverter set in Boot.scala using LiftRules.dateTimeConverter.default.set()?

Is this example correct, or is there better way?

    val mk :DateTimeConverter = LiftRules.dateTimeConverter.vend
    val dt
= mk.formatDateTime(new Date())

Antonio Salazar Cardozo

unread,
Nov 29, 2016, 5:58:59 PM11/29/16
to Lift
I think that's probably the best way. `vend` is implicit, so you may be able
to invoke it implicitly, but I think these are meant to be used with things that
accept a `Vendor[T]` rather than try to invoke `vend` directly. This allows you
to substitute a different vendor for e.g. tests.
Thanks,
Antonio

Colin Bester

unread,
Nov 29, 2016, 6:05:34 PM11/29/16
to Lift
Thanks, much appreciated. 

To be honest I not quite on the same wavelength on the factorymaker side of Lift and need to get my head around it. To date I use my own object singelton to provide common funtionality like formatting and parsing date time data.

Will look more into how to use Vendor[T] idea.

Diego Medina

unread,
Dec 2, 2016, 11:38:02 AM12/2/16
to Lift
Colin,

Don't feel that you always have to use Vendor[T], we use it for things that change from test to production, like, we expire cookies after 48 hours, but in test we set them to milliseconds. But then for date formats, we also use a singleton and that is simple and works well, we don't need to change the formatting of a date in test vs prod.

Thanks

Diego



--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

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



--
Diego Medina
Lift/Scala Consultant
di...@fmpwizard.com
https://blog.fmpwizard.com/

Colin Bester

unread,
Dec 2, 2016, 12:43:39 PM12/2/16
to Lift
Thanks Diego, appreciate that.

Colin
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages