mskocik / svelty-picker

Simple date & time picker in svelte
https://mskocik.github.io/svelty-picker/
202 stars 46 forks source link

Getting the following error qn.minuteSwitch is not a function #172

Open isAlmogK opened 6 months ago

isAlmogK commented 6 months ago

Hi, we are using the svelty picket in our app, and we are running into an edge case where the app crashed. Further debugging this, we see it is something within the picker

qn.minuteSwitch is not a function

Seems to be happing here

case "Enter":
        isFocused && e.preventDefault();
        if (currentMode === "time") {
          if (!timeEl.minuteSwitch(null)) {
            return timeEl.minuteSwitch(true);
          }
          return resetView();
        }
        if (isFocused && resolvedMode === "date") pickerVisible = false;
        if (innerDate && resolvedMode.includes("time")) {
          currentMode = "time";
        }
        break;

'timeEl' variable is the Time element that's used in

mskocik commented 6 months ago

What version of svelty-picker are you on? There is no such code on the latest version.

Edit: Seems you are on v3, which is too old. Try to update library to the latest.

isAlmogK commented 6 months ago

"svelty-picker": "^3.6.1",

mskocik commented 6 months ago

Try to update first, at least to v4 (which is the version, where this has been rewritten)

isAlmogK commented 6 months ago

Well do and update you