// Set utils function parseTime to filter // Filter for item status export const statusFilter = (status: string) => { return [ 'info', 'danger', 'success', ][status] } export function formatDate(value, fmt) { if (!value) return ""; const getDate = new Date(value) const o = { 'M+': getDate.getMonth() + 1, 'd+': getDate.getDate(), 'h+': getDate.getHours(), 'm+': getDate.getMinutes(), 's+': getDate.getSeconds(), 'q+': Math.floor((getDate.getMonth() + 3) / 3), S: getDate.getMilliseconds() } if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length)) } for (const k in o) { if (new RegExp('(' + k + ')').test(fmt)) { fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) } } return fmt } export function slice(value: string | any[], start, length?) { return value.slice(start, start + length); }