haavardj / ngx-cron-editor

Graphically build a CRON expression for Angular 6+
https://github.com/haavardj/ngx-cron-editor
MIT License
44 stars 78 forks source link

Outputting four-group cron expression instead of five #23

Closed jsfraz closed 9 months ago

jsfraz commented 1 year ago

I have following setup: example.component.ts:

  initCron: string = '0 0 1/1 * *';
  cronForm: FormControl = new FormControl(this.initCron);
  cronOptions: CronOptions = {
    defaultTime: "00:00:00",
    hideMinutesTab: true,
    hideHourlyTab: true,
    hideDailyTab: true,
    hideWeeklyTab: false,
    hideMonthlyTab: true,
    hideYearlyTab: true,
    hideAdvancedTab: true,
    hideSpecificWeekDayTab: false,
    hideSpecificMonthWeekTab: false,
    use24HourTime: true,
    hideSeconds: true,
    cronFlavor: "standard"
  };

example.component.html:

<cron-editor [formControl]="cronForm" [options]="cronOptions"></cron-editor>

Screenshot from 2023-09-04 13-26-43 When I check some days and then uncheck all of them, component returns four-group expression: 0 0 * *, which is invalid. Is his expected behaviour or a bug? I am using Angular 16.2.3.

This can be seen in demo as well, when unchecking Monday in Weekly tab. It occurs when not setting week days and only setting time too.

haavardj commented 9 months ago

I`m not sure if this is a feature or a bug :-) Fixed in commit 40700a9 so that days is set to * whenever no specific day is selected. Published in ngx-cron-editor@0.7.10