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

fp.setDate is not a function #36

Closed
cicerchia opened this issue Nov 9, 2021 · 3 comments
Closed

fp.setDate is not a function #36

cicerchia opened this issue Nov 9, 2021 · 3 comments

Comments

@cicerchia
Copy link

cicerchia commented Nov 9, 2021

fp.setDate is not a function.

@jacobmischka
Copy link
Owner

Your example works fine (except that you're using an <a> tag for what should really be a <button>): https://codesandbox.io/s/serene-northcutt-fgxdh?file=/App.svelte

Seems like something else in your configuration is going wrong. Please make sure you're using updated versions of all dependencies.

@jacobmischka
Copy link
Owner

jacobmischka commented Nov 9, 2021

On the web IDs must be unique to the page, you cannot use the same id for more than one element on the same page.

Change your IDs to make them unique.

  <Flatpickr bind:value={selectedDateTime} element="#my-picker">
    <div class="flatpickr" id="my-picker">
      <input
        type="text"
        class="my-custom-class"
        placeholder="Select Date..."
        data-input
      />

      <button type="button" data-clear>Clear</button>
    </div>
  </Flatpickr>

  <Flatpickr bind:value={selectedDateTime} element="#my-picker2">
    <div class="flatpickr" id="my-picker2">
      <input
        type="text"
        class="my-custom-class"
        placeholder="Select Date..."
        data-input
      />

      <button type="button" data-clear>Clear</button>
    </div>
  </Flatpickr>

@jacobmischka
Copy link
Owner

If you need to do this programmatically in a component, you can use something like gud to generate a unique ID at runtime.

@cicerchia cicerchia changed the title fp.setDate is not a function . Nov 9, 2021
@cicerchia cicerchia changed the title . fp.setDate is not a function Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants