I have a date input box in my lift application, and I want to check that a user-entered date is in correct format: dd/mm/yyyy.
How can I write a reg
It's a good practice to define the DateTimeFormatter
instance in an object since it's thread-safe and immutable.
object DateOfBirth{
import org.joda.time.format.DateTimeFormat
import scala.util.Try
val fmt = DateTimeFormat forPattern "MM/dd/yyyy"
def validate(date: String) = Try(fmt.parseDateTime(date)).isSuccess
}