Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
对于给定的类:
class User { Date birthday }
如何进行约束以确保生日是用户在表单中输入的日期?
如果您使用数据绑定,如果它不是日期,它将被设置为 null。如果您不这样做,请执行以下操作以确保它是一个日期:
user.birthday = params.date("dateField")