util.js
881 Bytes
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Util = (function () {
function Util() {
}
Util.getISODate = function () {
return (new Date()).toISOString().slice(0, 10);
};
Util.getDateInMinutes = function () {
var now = new Date();
return (now.getHours() * 60) + now.getMinutes();
};
/**
* convert a time input to minutes
* e.g. 23:59 = 1439
*/
Util.convertToMinutes = function (time) {
var times = time.split(":");
var convered = (parseInt(times[0]) * 60) + parseInt(times[1]);
return (convered >= 0 && convered <= 1439) ? convered : 0;
};
Util.calculateNextMinute = function () {
return (60 - (Math.round((new Date()).getTime() / 1000) % 60)) * 1000;
};
return Util;
}());
exports.Util = Util;
//# sourceMappingURL=util.js.map