sojinantony01 / react-cron-generator

Simple react component to generate cron expressions
MIT License
86 stars 63 forks source link

Access Result text #33

Closed bahare-enplore closed 2 years ago

bahare-enplore commented 2 years ago

Hi there, is it possible to access ResultText outside the component? I'm working with a functional component :) https://codesandbox.io/s/reaact-cron-generator-01f4d?file=/src/CronGenerator.jsx

SojinAntony commented 2 years ago

I am using cronstrue (https://www.npmjs.com/package/cronstrue) package to convert the corn value to text, you can use it anywhere outside the package. also, I will try to add it to the package itself. thanks for the suggestion

bahare-enplore commented 2 years ago

Thank you @SojinAntony

sojinantony01 commented 2 years ago

@bahare-enplore I have updated the package, with the above support (1.3.3). the result will be there in onChange second argument. Here is a working example as you need https://codesandbox.io/s/react-cron-generator-forked-4oznd

please note: the latest version is using the latest bootstrap (4.x) if you need it in the old bootstrap version install https://www.npmjs.com/package/cronstrue/v/1.71.0 old version example - https://codesandbox.io/s/react-cron-generator-forked-yf257?file=/src/CronGenerator.jsx