sojinantony01 / react-cron-generator

Simple react component to generate cron expressions
MIT License
78 stars 62 forks source link

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

Closed vvrahul closed 1 year ago

vvrahul commented 2 years ago

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

sojinantony01 commented 2 years ago

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

vvrahul commented 2 years ago

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

sojinantony01 commented 2 years ago

@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

vvrahul commented 2 years ago

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

vvrahul commented 2 years ago

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

SojinAntony commented 2 years ago

"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

sojinantony01 commented 1 year ago

Closing the issue as question is invalid