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

Minimal interval #25

Closed dana93os closed 2 years ago

dana93os commented 2 years ago

We're using your library and sometimes we want to disable selecting the "every minute" interval or set some kind of minimal interval.

xrutayisire commented 2 years ago

Hello,

Thanks for using this library!

Without any modification you can already do something like this.

dana93os commented 2 years ago

Wow, perfect! Thank you for developing it! Any way to contribute financially?

dana93os commented 2 years ago

We used that error, all fine. But anyway I think if we can hide the ability to select minutes it will be even better in terms of UI/UX.

xrutayisire commented 2 years ago

Thanks for the support!! I currently don't have a donation system in place, but I could think about it If you want to support this library 😃

I agree with you that it can be a new feature. I have some questions to think about it:

dana93os commented 2 years ago

You are right. Maybe this is not the library problem.

Will explain more about what we do, maybe it will be helpful for you to understand me.

We wanted to limit our clients of running tasks every minute or even every hour. So we added this rule to check:

    const items = value.split(' ');

    if (value === '* * * * *' || items[1] === '*') {
      setError('The interval is too small');
    } else {
      setError(null);
    }

Yes, it will be possible to run almost every hour (23/24) if some user will really want it and select all 23 hours, but it's okay at least for now.

Thanks, for your help and support! Maybe the library is not so big but it's working well!