element-ui 时间转换成cron 数据格式

268 阅读1分钟

`export default {

// linux crontab格式数据 每天的时间
day(time: string) {
    const timer = time.split(":");
    return `${timer[1]} ${timer[0]} * * *`;
},
// 每周的周几
week(time: string, week: string[]) {
    const timer = time.split(":");
    const weeks = week.join(",");
    return `${timer[1]} ${timer[0]} * * ${weeks}`;
},
// 每月的哪些天
month(time: string, month: any) {
    const timer = time.split(":");
    const months = month.join(",");
    return `${timer[1]} ${timer[0]} ${months} * *`;
}

};`