Commit 286229ae authored by Sebastián Katzer's avatar Sebastián Katzer
Browse files

Even more type checking

parent e6041089
Loading
Loading
Loading
Loading
+10 −4
Changes for www/local-notification.js: 10 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -520,19 +520,25 @@ exports.mergeWithDefaults = function (options) {
 */
exports.convertProperties = function (options) {

    if (options.date === undefined || options.date === null) {
        options.date = new Date();
    }

    options.id         = options.id.toString();
    options.title      = options.title.toString();
    options.message    = options.message.toString();
    options.autoCancel = options.autoCancel === true;

    if (isNaN(options.id)) {
        options.id = this.getDefaults().id;
    }

    if (isNaN(options.badge)) {
        options.badge = this.getDefaults().badge;
    }

    options.badge = Number(options.badge);

    if (options.date === undefined || options.date === null) {
        options.date = new Date();
    }

    if (typeof options.date == 'object') {
        options.date = Math.round(options.date.getTime()/1000);
    }