Function calcCron

  • 生成 cron 表达式

    Parameters

    • options: {
          day: undefined | string;
          hour: undefined | string;
          minute: undefined | string;
          month: undefined | string;
          week: undefined | string;
      } = {}

      cron 配置

      • day: undefined | string
      • hour: undefined | string
      • minute: undefined | string
      • month: undefined | string
      • week: undefined | string

    Returns string

    calcCron(); /// '* * * * *'
    calcCron({ minute: '30', hour: '1', day: '10'}); /// '30 1 10 * *'
    calcCron({ week: '?' }); /// '* * * * ?'
    calcCron({ week: '*' }); /// '* * * * *'
    calcCron({ week: 0 }); /// '* * * * 0'
    calcCron({ week: '0' }); /// '* * * * 0'
    calcCron({ week: '7' }); /// '* * * * 0'
    calcCron({ week: 'SUN,天,日,六,6,5' }); /// '* * * * 0,5,6'
    calcCron({ day: '1-5' }); /// '* * 1-5 * * '
    calcCron({ day: '1,5' }); /// '* * 1,5 * * '
    calcCron({ day: '1/5' }); /// '* * 1/5 * * '