sojinantony01/react-cron-generator

Cron generator Tabs are not retaining when we assigning the value in edit mode

vvrahul opened this issue · 7 comments

Cron generator Tabs are not retaining when we assigning the value in in our application (edit mode)

Please provide more details.
which cron value you tried to assign?
which tab is not retained?

Am using this package for sync schedule generator and am saving the Cron value in the DB for particular user and when user come back to this page am taking the Cron value from DB and assigning it back to the Cron component
<Cron value={scheduledValue} showResultText={true} showResultCron={false} />

scheduledValue is the Cron value and am not showing Cron to user only the result text is showing .

Suppose I have selected Monthly from the tab and save it to DB and again am coming back to the page and the Cron generator is showing Correct result text. but the Tab which i have selected is not retaining its showing different tab preselected

@vvrahul
As you know, the package calculates the selected tab from the given cron value. there are possibilities of the same cron value in a different tab.

For example
if you select "Every 1 days" from the Daily tab
it will show The second option in Hourly tab next time
because the value is same in both cases

We are not storing the selected tab anywhere

Please share the cron values which you found the tab mismatches. so that I can check whether it is possible or not

If you really need to retain the selected tab you can customize the package to get the selected tab back to your parent component and you can store it in DB along with the value

There are a lot of crons
**0 0/1 0 L * ? *** for this, i have selected this from the monthly tab (last day of Every month) but it is showing custom TAB

And one more thing i noticed that.. when i remove
const syncSchedulerOptions = { headers: [HEADER.MONTHLY, HEADER.WEEKLY, HEADER.HOURLY, HEADER.DAILY, HEADER.CUSTOM] }; Header options its working fine

"**0 0/1 0 L * ? *** " this is not a valid 6 or 7 value cron
that's why it is showing the custom tab

please share some valid values if you found a tab mismatch

Closing the issue
as question is invalid