Skip to content

Commit

Permalink
Remove orphaned functions for date string manipulations
Browse files Browse the repository at this point in the history
  • Loading branch information
Buck Bito authored and Buck Bito committed Apr 23, 2017
1 parent e8fdbdc commit a59dad7
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions lib/mysql.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,42 +307,6 @@ MySQL.prototype.updateOrCreate = function(model, data, options, cb) {
this._modifyOrCreate(model, data, options, fields, cb);
};

function dateToMysql(dt, tz) {
if (!tz || tz == 'local') {
return dt.getFullYear() + '-' +
fillZeros(dt.getMonth() + 1) + '-' +
fillZeros(dt.getDate()) + ' ' +
fillZeros(dt.getHours()) + ':' +
fillZeros(dt.getMinutes()) + ':' +
fillZeros(dt.getSeconds());
} else {
tz = convertTimezone(tz);

if (tz !== false && tz !== 0) dt.setTime(dt.getTime() + (tz * 60000));

return dt.getUTCFullYear() + '-' +
fillZeros(dt.getUTCMonth() + 1) + '-' +
fillZeros(dt.getUTCDate()) + ' ' +
fillZeros(dt.getUTCHours()) + ':' +
fillZeros(dt.getUTCMinutes()) + ':' +
fillZeros(dt.getUTCSeconds());
}

function fillZeros(v) {
return v < 10 ? '0' + v : v;
}

function convertTimezone(tz) {
if (tz === 'Z') {
return 0;
}

var m = tz.match(/([\+\-\s])(\d\d):?(\d\d)?/);
if (m) return (m[1] == '-' ? -1 : 1) * (parseInt(m[2], 10) + ((m[3] ? parseInt(m[3], 10) : 0) / 60)) * 60;
return false;
}
}

MySQL.prototype.getInsertedId = function(model, info) {
var insertedId = info && typeof info.insertId === 'number' ?
info.insertId : undefined;
Expand Down

0 comments on commit a59dad7

Please sign in to comment.