Closed jkardong closed 8 years ago
Actually if you look at the readme file, it shows that now accepts a string. But I agree that using a Date object would be ideal.
I actually got the Date() to work by changing the line in the wickedpicker.js file to a MomentJS parse with the following line
var time = [moment().format("H"),moment().format("m"),moment().format("s")];
in place of
var time = this.options.now.replace(':', ' ').split(' ');
I already had MomentJS installed so of course adds overhead for you, but it got it working for me as I needed to enter the current time into the WickedPicker enabled field
Description
With the latest build of the WickedPicker, there is a Javascript error when the wickedpicker.js is called. Line 68 calls the following:
var time = this.options.now.replace(':', ' ').split(' ');
Which throws
this.options.now.replace is not a function
Repro
In the WickedPicker project index.html, change the line to the following
$('.timepicker').wickedpicker({now: new Date(), twentyFour: false, title: 'My Timepicker', showSeconds: true})
Note the error Console
Expected Result
No error thrown
Actual Result
Error is thrown and JS call fails to load time picker