var CPATH = ''; var WPATH = ''; var DPATH = 'data'; function htmlEscape(str) { return String(str) .replace(/&/g, '&') .replace(/"/g, '"') .replace(/'/g, ''') .replace(//g, '>'); } function regexpEscape(s) { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\\$&'); }; function normalizeDate(date, first) { var str = date.replace( /[A-Za-z0-9-ー/!”#$%&’()=<>,.?_[]{}@^~¥]/g, function(s) { return String.fromCharCode(s.charCodeAt(0) - 65248); }); if(str.match(/^\d{4}\/\d{2}\/\d{2}$/)) { // YYYY/MM/DD return str; } else if(str.match(/^(\d{4})(\d{2})(\d{2})$/)) { // YYYYMMDD return RegExp.$1 + '/' + RegExp.$2 + '/' + RegExp.$3; } else if(str.match(/^(\d{4})\/(\d{2})$/)) { // YYYY/MM return first ? str + '/01' : str + '/' + new Date(RegExp.$1, RegExp.$2, 0).getDate(); } else if(str.match(/^(\d{4})(\d{2})$/)) { // YYYYMM return first ? RegExp.$1 + '/' + RegExp.$2 + '/01' : RegExp.$1 + '/' + RegExp.$2 + '/' + new Date(RegExp.$1, RegExp.$2, 0).getDate(); } else if(str.match(/^(\d{4})$/)) { // YYYY return first ? RegExp.$1 + '/01/01' : RegExp.$1 + '/12/31'; } return date; } function validateDate(year, month, day) { var y = parseInt(year, 10); var m = parseInt(month, 10); var d = parseInt(day, 10); var date = new Date(y, m - 1 ,d); return (date.getFullYear() === y && date.getMonth() + 1 === m && date.getDate() === d); } function isSmartPhone() { return false; } function isIos() { return false; }