Help us understand the problem. What is going on with this article?

flatpickr を適用した mobile 側の input time で second(秒) の入力が消えない

tl;dr

step="60" で回避したらいいんやで。

<input type="time" step="60">

事象

flatpickr version: 4.5.2

flatpickr 最強じゃね?イエーイからの、スマホで time 入力しようとしたら enableSeconds: false を何度コンフィグっても、秒(もはやミリ秒まで)も入力させられてイラくる。そもそも enableSeconds はデフォルトで false だっつーの。

原因

ソースみたら setupMobile() 内で self.mobileInput.step = self.input.getAttribute("step") || "any"; してて全く enableSeconds なんか一切見てない。 step 設定してないと無理やり any られるってのがわかる。

      function setupMobile() {
        var inputType = self.config.enableTime ? self.config.noCalendar ? "time" : "datetime-local" : "date";
        self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile");
        self.mobileInput.step = self.input.getAttribute("step") || "any";

解決

self.input.getAttribute("step") って書いてるので、 input に step を好きなように追加してやりゃおk。 input time の step は秒単位らしいから、分だけでいいなら step="60" しとく。

<input type="time" step="60">
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away