String.prototype.toDate = function()

in web/src/main/resources/static/js/date.js [34:63]


String.prototype.toDate = function (style) {
  var y = this.substring(style.indexOf('y'), style.lastIndexOf('y') + 1);// 年
  var m = this.substring(style.indexOf('M'), style.lastIndexOf('M') + 1);// 月
  var d = this.substring(style.indexOf('d'), style.lastIndexOf('d') + 1);// 日
  var h = this.substring(style.indexOf('h'), style.lastIndexOf('h') + 1);// 时
  var i = this.substring(style.indexOf('m'), style.lastIndexOf('m') + 1);// 分
  var s = this.substring(style.indexOf('s'), style.lastIndexOf('s') + 1);// 秒
  if (isNaN(y)) {
    y = new Date().getFullYear();
  }
  if (isNaN(m)) {
    m = new Date().getMonth();
  }
  if (isNaN(d)) {
    d = new Date().getDate();
  }
  if (isNaN(h)) {
    h = new Date().getHours();
  }
  if (isNaN(i)) {
    i = new Date().getMinutes();
  }
  if (isNaN(s)) {
    s = new Date().getSeconds();
  }
  var dt;
  eval("dt = new Date('" + y + "', '" + (m - 1) + "','" + d + "','" + h
      + "','" + i + "','" + s + "')");
  return dt;
}