kitchen-cli icon indicating copy to clipboard operation
kitchen-cli copied to clipboard

Small issue in form_util.js secondsToTime function

Open johnf76 opened this issue 8 years ago • 1 comments

When using a valid time "s" is numeric which causes "s.toUpperCase()" to throw an exception resulting in the time field not being set.

this.secondsToTime = function(seconds, timeFormat) {
    var s = seconds || 0;
    var tf = timeFormat || "h:mm a";
    if(s.toUpperCase() == "NOW") {
        return moment(new Date()).format(tf);
    }

    return moment.unix(s).utc().format(tf);
};

Should be:

this.secondsToTime = function(seconds, timeFormat) {
    var s = seconds || 0;
    var tf = timeFormat || "h:mm a";
    if(String(s).toUpperCase() === "NOW") {
        return moment(new Date()).format(tf);
    }

    return moment.unix(s).utc().format(tf);
};

johnf76 avatar Mar 05 '16 11:03 johnf76

@lyftsoftware thank you! Fixed and will be available in next version (0.9.58)

perak avatar Mar 05 '16 15:03 perak