智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/ed/ed9dc8613aec3f0bd0a0cf2c4ed...

18 lines
403 B

var isDate = require('./isDate');
var isStr = require('./isStr');
exports = function(val) {
if (!val) return new Date();
if (isDate(val)) return val;
if (isStr(val)) {
var match = val.match(regDate);
if (match) return new Date(match[1], match[2] - 1, match[3]);
}
return new Date(val);
};
var regDate = /^(\d{4})-?(\d{2})-?(\d{1,2})$/;
module.exports = exports;