ericjgagnon / wickedpicker

A simple jQuery timepicker
http://ericjgagnon.github.io/wickedpicker/
MIT License
93 stars 78 forks source link

BUG: wickedpicker.js throws error #2

Closed jkardong closed 8 years ago

jkardong commented 8 years ago

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

Expected Result

No error thrown

Actual Result

Error is thrown and JS call fails to load time picker

System Details

ericjgagnon commented 8 years ago

I fixed the bad merge with the develop branch on the master branch, but I don't know if this issue is related. The replace function is a JavaScript standard, and is supported across multiple browsers, versions, and also in mobile. It's been around since ECMAScript V3. The key 'now' in the options object is set to the current time by default, but if you'd like to enter a default time, then it's expecting a string in the form 'HH:MM' (24 hour format only).

jkardong commented 8 years ago

Yeah, I don't get it. Breaks on Mac, PC, and every browser I've tried. Is there some other reference that needs to be added to a page using the WickedPicker that is being used perhaps? Do you have a test page that is using the newest build I can compare to?

ericjgagnon commented 8 years ago

Sorry, I cannot duplicate this.

jkardong commented 8 years ago

I worked to get this to use the "split", but just wouldn't, and truly could not figure out what the issue was. By all accounts, it should totally work. I ended up using MomentJS to set the Hour, Minute, Seconds like this:

var time = [moment().format("H"),moment().format("m"),moment().format("s")];

Do you see any issue with doing this? Seems to work, but not sure.