(interval int, unit string)
| 261 | } |
| 262 | |
| 263 | func intervalToMinutes(interval int, unit string) (int, error) { |
| 264 | switch unit { |
| 265 | case "m", "minutes": |
| 266 | return interval, nil |
| 267 | case "h", "hours": |
| 268 | return interval * 60, nil |
| 269 | case "d", "days": |
| 270 | return interval * 24 * 60, nil |
| 271 | case "w": |
| 272 | return interval * 7 * 24 * 60, nil |
| 273 | case "mo": |
| 274 | return interval * 30 * 24 * 60, nil |
| 275 | default: |
| 276 | return 0, fmt.Errorf("unsupported duration unit '%s'", unit) |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | func formatShortDurationCron(interval int, unit string, hasWeekdaysSuffix bool) (string, error) { |
| 281 | switch unit { |
no test coverage detected