import { useField } from 'formik'; import { string } from 'yup'; import { FormControl } from '@@/form-components/FormControl'; import { Input } from '@@/form-components/Input'; import { TimeTip } from './TimeTip'; export function AdvancedCronFieldset() { const [{ value, onChange, name, onBlur }, { error }] = useField('cronExpression'); return ( <> ); } /** https://regexr.com/573i2 */ const cronRegex = /(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ){4,6}((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*))/; export function cronValidation() { return string() .default('') .matches(cronRegex, 'This field format is invalid.'); }