public static Date tryParseDate(String date) { try { return new Date(Long.parseLong(date)); } catch (NumberFormatException ignored) { } try { JsDate js = JsDate.create(date); return new Date((long) js.getTime()); } catch (JavaScriptException ignored) { } return null; }
@Override public void fireOnSqlChange(String sql, List<Object> args) { JsArrayMixed jarg = (JsArrayMixed) JavaScriptObject.createArray(); for (Object o : args) { if (o == null) { jarg.push((JavaScriptObject) null); } else if (o instanceof String) { jarg.push((String) o); } else if (o instanceof Date) { jarg.push(JsDate.create(((Date) o).getTime())); } else { throw new IllegalArgumentException("Don't know how to handle " + o); } } config.fireOnSqlChange(sql, jarg); }