xrutayisire / react-js-cron

A React cron editor built with antd
https://xrutayisire.github.io/react-js-cron/?path=/docs/reactjs-cron--demo
MIT License
238 stars 105 forks source link

Inability to Edit Weekly Cron for Every Day of the Week in react-js-cron #62

Open Gunjansokal07 opened 10 months ago

Gunjansokal07 commented 10 months ago

Description:

I am utilizing the react-js-cron to create weekly cron expressions. However, when attempting to edit a cron expression for all days of the week, the editor automatically switches to a daily mode. Specifically, when I input a weekly cron expression for every day of the week, such as '10 10 *,' the editor incorrectly converts it to a daily cron format.

Here are the steps to reproduce the issue, broken down point by point:

  1. Select the "Weekly" cron option.
  2. Leave the "Day of the Week" setting as "Every Day."
  3. Choose specific "Hour" and "Minute" values.
  4. The resulting cron expression will be "10 10 *."
  5. After saving this cron expression, when you attempt to edit it,
  6. The editor incorrectly converts the default "Weekly" dropdown option to "Daily."
  7. The "Hour" and "Minute" values are retained from the previous input.

Versions (please complete the following information):

xrutayisire commented 10 months ago

Hi,

If I understood your use case, it's normal.

10 10 * * * means every day of the week at 10:10, right? But it also means every day at 10:10, right?

It's the same thing. This cron component is designed to make you read the most easy format.

Every day at 10:10 = Every week on every day of the week at 10:10 = Every month on every day of the month n every day of the week at 10:10, ect...

Let me know if I understood what you meant?

Gunjansokal07 commented 10 months ago

Hi @xrutayisire, thank you for your quick response.

Yes, you've understood the issue correctly. However, when we set the defaultPeriod to "Weekly" and then set the cron value as "10 10 *" [using default value for cron], it should persist the period as "Weekly." But it appears to be changing the period in the dropdown to "Daily."

Could you please look into this? Your assistance is greatly appreciated.

xrutayisire commented 10 months ago

Hi,

It's true that the default value for period should be persisted. Also, the same problem happens when we set to only allow "Weekly" period, daily will be selected when it should keep the only allowed one.

It's necessary to rework the period management and the fallback system. I currently don't have time to fix that, if you want to open a PR I would review it.

If not, I will do it, but I'm not really sure when. Could be something in November.

Thank you for the bug report šŸ™

Gunjansokal07 commented 10 months ago

Thanks @xrutayisire for response. I am also little bit busy with work. But I will try to look into this. Meanwhile if you get the time then kindly fix it.

Thanks in advance.

Gunjansokal07 commented 6 months ago

Hi,

It's true that the default value for period should be persisted. Also, the same problem happens when we set to only allow "Weekly" period, daily will be selected when it should keep the only allowed one.

It's necessary to rework the period management and the fallback system. I currently don't have time to fix that, if you want to open a PR I would review it.

If not, I will do it, but I'm not really sure when. Could be something in November.

Thank you for the bug report šŸ™

Hi @xrutayisire , Is there any update on this?

xrutayisire commented 5 months ago

Hi,

No sorry I really have no time since quite some time now. I'm not sure when I could take care of that in a near future. šŸ˜•