好吧,这是到目前为止我尝试过的代码。
public class CustomDateEditorRegistrar implements PropertyEditorRegistrar {
public void registerCustomEditors(PropertyEditorRegistry registry) {
registry.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("MM/dd/yyyy hh:mm a"), true))
registry.registerCustomEditor(Date.class, new StructuredDateEditor(new SimpleDateFormat("MM/dd/yyyy"), true))
}
}
我使用的是日历jQuery插件和常规的Grails DatePicker,如果仅使用第一个,则总是会遇到常规的grails Date Picker错误。如果同时使用两者,则不会再出现错误。.但是,日历只保存日期而不是时间?有任何解决这个问题的方法吗? :(
最佳答案
关于grails - 如何将registerCustomEditors用于多个日期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12088519/