src/lib/code.js
function strToDate(str) {
  var tempStrs = str.split(" ");
  var dateStrs = tempStrs[0].split("-");
  var year = parseInt(dateStrs[0], 10);
  var month = parseInt(dateStrs[1], 10) - 1;
  var day = parseInt(dateStrs[2], 10);
  if (tempStrs.length > 1) {
    var timeStrs = tempStrs[1].split("-");
    var hour = parseInt(timeStrs [0], 10);
    var minute = parseInt(timeStrs[1], 10) - 1;
    var second = parseInt(timeStrs[2], 10);
    return new Date(year, month, day, hour, minute, second);
  }

  return new Date(year, month, day);
}
function strToDate(str) {
  var tempStrs = str.split(" ");
  var dateStrs = tempStrs[0].split("-");
  var year = parseInt(dateStrs[0], 10);
  var month = parseInt(dateStrs[1], 10) - 1;
  var day = parseInt(dateStrs[2], 10);
  if (tempStrs.length > 1) {
    var timeStrs = tempStrs[1].split("-");
    var hour = parseInt(timeStrs [0], 10);
    var minute = parseInt(timeStrs[1], 10) - 1;
    var second = parseInt(timeStrs[2], 10);
    return new Date(year, month, day, hour, minute, second);
  }

  return new Date(year, month, day);
}
function strToDate ( str ) { var tempStrs = str . split ( " " ) ; var dateStrs = tempStrs [ 0 ] . split ( "-" ) ; var year = parseInt ( dateStrs [ 0 ] , 10 ) ; var month = parseInt ( dateStrs [ 1 ] , 10 ) - 1 ; var day = parseInt ( dateStrs [ 2 ] , 10 ) ; if ( tempStrs . length > 1 ) { var timeStrs = tempStrs [ 1 ] . split ( "-" ) ; var hour = parseInt ( timeStrs [ 0 ] , 10 ) ; var minute = parseInt ( timeStrs [ 1 ] , 10 ) - 1 ; var second = parseInt ( timeStrs [ 2 ] , 10 ) ; return new Date ( year , month , day , hour , minute , second ) ; } return new Date ( year , month , day ) ; }
yyyy-MM-DD HH-mm-ss
yyyy - MM - DD HH - mm - ss