Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let date;
if (time instanceof Date) {
date = time;
} else {
const intTime = parseInt(time, 10);
const len = (String(time)).length;
if (len === 10 && intTime == time) { // eslint-disable-line eqeqeq
date = new Date(intTime * 1000);
} else if (len > 10 && len <= 13 && intTime == time) { // eslint-disable-line eqeqeq
date = new Date(intTime);
} else {
return time;
}
}
return fecha.format(date, cFormat);
}
onClick (picker) {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 180)
picker.$emit('pick', [start, end])
}
}, {
text: '当月' + dateUtil.format(new Date(), 'yyyy-M'),
onClick (picker) {
const end = new Date()
const start = new Date()
start.setDate(1)
picker.$emit('pick', [start, end])
}
}, {
text: '前月' + dateUtil.format(new Date().setDate(0), 'yyyy-M'),
onClick (picker) {
const end = new Date()
end.setDate(0)
const start = new Date()
start.setDate(1)
start.setMonth(start.getMonth() - 1, 1)
picker.$emit('pick', [start, end])
}
}, {
text: '当周',
onClick (picker) {
const end = new Date()
let start = new Date()
start.setDate(start.getDate() - start.getDay() + 1)
picker.$emit('pick', [start, end])
}
formatedToday() {
return fecha.format(this.now, 'yyyy-MM-dd');
},
formatCreateDate: function (row, column) {
let date = new Date(row.createDate);
return dateUtil.format(date, 'yyyy-MM-dd HH:mm:ss');
},
deleteTopicMethod(zookeeper, topic) {
formatDate (date, format) {
date = utils.toDate(date)
if (!date) return ''
return dateUtil.format(date, format || 'yyyy-MM-dd')
},
formatDateTime (date, format) {
curMonthDatePrefix() {
return fecha.format(this.date, 'yyyy-MM');
},
prevMonthDatePrefix() {
const temp = new Date(this.date.getTime());
temp.setDate(0);
return fecha.format(temp, 'yyyy-MM');
},
formatDate(timestamp) {
if (!timestamp) return '';
return dateUtil.format(new Date(timestamp), 'yyyy-MM-dd HH:mm');
},
uploadClick() {
prevMonthDatePrefix() {
const temp = new Date(this.date.getTime());
temp.setDate(0);
return fecha.format(temp, 'yyyy-MM');
},
formatDateTime (date, format) {
date = utils.toDate(date)
if (!date) return ''
return dateUtil.format(date, format || 'yyyy-MM-dd HH:mm:ss')
},
formatSeconds (value) {