Move padNumber() to utils.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
XhmikosR
2020-05-25 12:38:36 +03:00
parent 7f71f1d5fe
commit 61c29cafc4
3 changed files with 19 additions and 22 deletions

View File

@@ -50,10 +50,6 @@ $(function () {
);
});
function padNumber(num) {
return ("00" + num).substr(-2, 2);
}
var timeLineChart;
function compareNumbers(a, b) {
@@ -197,28 +193,28 @@ $(document).ready(function () {
var fromDate =
time.getFullYear() +
"-" +
padNumber(time.getMonth() + 1) +
utils.padNumber(time.getMonth() + 1) +
"-" +
padNumber(time.getDate());
utils.padNumber(time.getDate());
var fromTime =
padNumber(time.getHours()) +
utils.padNumber(time.getHours()) +
":" +
padNumber(time.getMinutes()) +
utils.padNumber(time.getMinutes()) +
":" +
padNumber(time.getSeconds());
utils.padNumber(time.getSeconds());
time = new Date(time.valueOf() + 1000 * interval);
var untilDate =
time.getFullYear() +
"-" +
padNumber(time.getMonth() + 1) +
utils.padNumber(time.getMonth() + 1) +
"-" +
padNumber(time.getDate());
utils.padNumber(time.getDate());
var untilTime =
padNumber(time.getHours()) +
utils.padNumber(time.getHours()) +
":" +
padNumber(time.getMinutes()) +
utils.padNumber(time.getMinutes()) +
":" +
padNumber(time.getSeconds());
utils.padNumber(time.getSeconds());
if (fromDate === untilDate) {
// Abbreviated form for intervals on the same day