flatpickr icon indicating copy to clipboard operation
flatpickr copied to clipboard

Load config dynamicly

Open Yamakasi opened this issue 7 years ago • 3 comments

Is there a way to create configs, assign them to a var and load them dynamicly ?

Yamakasi avatar Oct 28 '18 22:10 Yamakasi

import flatpickr from "flatpickr";

  // Override Global settings
  flatpickr.setDefaults({
    disableMobile: true
  });

You can also modify configs for a specific input field.

instanceVariable.set(configObject)

This should be in docs already

ankurk91 avatar Nov 02 '18 06:11 ankurk91

Yup it's documented here. This issue can be closed.

armujahid avatar Sep 16 '19 14:09 armujahid

Unfortunately the instance#set cannot be used to dynamically enable or disable the timepicker.

console.log(fp.config.enableTime) // false
fp.set('enableTime', true)
console.log(fp.config.enableTime) // true

It dose so in the code, but the DOM dose not re-render. Please have a look at https://jsfiddle.net/fg7pk5ec/15/

LukasOchmann avatar Aug 19 '22 08:08 LukasOchmann