GWT - 日期验证

0 gwt

谁能告诉我如何在GWT中进行日期验证.我把日期作为字符串传递.它应该转换为日期格式,并且其格式将被验证.

Chr*_*her 5

import com.google.gwt.i18n.client.DateTimeFormat;

...
DateTimeFormat myDateTimeFormat = DateTimeFormat.getFormat(...);
Date date = myDateTimeFormat.parseStrict(dateString);
Run Code Online (Sandbox Code Playgroud)

parseStrict() 为无效的日期字符串抛出IllegalArgumentException.