Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when setting state with less header options than default #38

Closed
Nathan-Limbik opened this issue May 25, 2022 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@Nathan-Limbik
Copy link

Hi, when using less than the default number of headers, an error occurs when setting an initial Cron value:

Error
Value does not match any available headers.

import React from "react";
import Cron from "react-cron-generator";
import "react-cron-generator/dist/cron-builder.css";
import { HEADER } from "react-cron-generator";

export default function App() {
  const [val, setVal] = React.useState("0 0 00 ? * TUE,THU,SAT *");
  const options = { headers: [HEADER.DAILY, HEADER.WEEKLY, HEADER.MONTHLY] };

  return (
    <div>
      <Cron
        onChange={setVal}
        value={val}
        showResultText={true}
        showResultCron={true}
        options={options}
      />
    </div>
  );
}
@SojinAntony
Copy link
Contributor

Thanks @Nathan-Limbik
I have found the issue
I will try to fix the issue today itself

@sojinantony01 sojinantony01 self-assigned this May 26, 2022
@sojinantony01 sojinantony01 added the bug Something isn't working label May 26, 2022
@sojinantony01
Copy link
Owner

The issue is fixed in the latest cron generator version
Version: 1.3.6

vvrahul added a commit to vvrahul/react-cron-generator-new that referenced this issue May 27, 2022
sojinantony01#38 selected tab logic fix for optional headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants