Repository: flatpickr/flatpickr (ts)

Issue:
Time picker on Android shows outdated native dialog
When you use the [Time Picker](https://flatpickr.js.org/examples/#time-picker) example on docs with a Android device a dialog shows up which looks nothing like the date picker dialog. It even lets you select milliseconds and microseconds even though the `dateFormat` is `H:i`.

![image](https://user-images.githubusercontent.com/2737132/67004020-9fbf5300-f0df-11e9-9a97-ec94d01b14a5.png)

Looking a bit further into it I noticed that this behavior is caused by the `step="any"` attribute which gets automatically applied to the mobile input when the original input has not `step` attribute set.
Removing the attribute completely or setting ist to `0` shows the "regular" Android time picker.

![image](https://user-images.githubusercontent.com/2737132/67004168-f6c52800-f0df-11e9-8e24-98f0bb390719.png)

## Your Environment
* flatpickr version used: 4.6.3
* Browser name and version: Google Chrome 77.0
* OS and version: Android 7.1.1


Pull request description:
fix: only apply `step` attribute to mobile input when present on main input (closes #1982)
This PR makes sure to only apply the `step` attribute to the mobile input when it's present on the main input. Setting it always and use `any` as fallback values can cause issues on some mobile devices.

Closes #1982.

Patch:
diff --git a/src/index.ts b/src/index.ts
index d4ec5fb1..7dea3296 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -2575,7 +2575,6 @@ function FlatpickrInstance(
       "input",
       self.input.className + " flatpickr-mobile"
     );
-    self.mobileInput.step = self.input.getAttribute("step") || "any";
     self.mobileInput.tabIndex = 1;
     self.mobileInput.type = inputType;
     self.mobileInput.disabled = self.input.disabled;
@@ -2602,6 +2601,9 @@ function FlatpickrInstance(
     if (self.config.maxDate)
       self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d");
 
+    if (self.input.getAttribute("step"))
+      self.mobileInput.step = String(self.input.getAttribute("step"));
+
     self.input.type = "hidden";
     if (self.altInput !== undefined) self.altInput.type = "hidden";
 


Test patch:
diff --git a/src/__tests__/index.spec.ts b/src/__tests__/index.spec.ts
index 1839c75a..b901e668 100644
--- a/src/__tests__/index.spec.ts
+++ b/src/__tests__/index.spec.ts
@@ -860,7 +860,7 @@ describe("flatpickr", () => {
         });
 
         describe("step attribute", () => {
-          it("copy value if setted", () => {
+          it("copy value if present", () => {
             const el = document.createElement("input");
             el.setAttribute("step", "3");
 
@@ -872,7 +872,7 @@ describe("flatpickr", () => {
             expect(mobileInput.getAttribute("step")).toBe("3");
           });
 
-          it("set 'any' value if not setted", () => {
+          it("don't set a default value if not present", () => {
             const el = document.createElement("input");
             el.removeAttribute("step");
 
@@ -881,7 +881,7 @@ describe("flatpickr", () => {
 
             const mobileInput = fp.mobileInput as HTMLInputElement;
 
-            expect(mobileInput.getAttribute("step")).toBe("any");
+            expect(mobileInput.getAttribute("step")).toBe(null);
           });
         });