-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (34 loc) · 1.05 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEmptyObject = exports.formatDate = void 0;
// Use for firebase timestamps, pass in time bool to get time back in result
var formatDate = function (timestamp, returnTime) {
// Get date from timestamp
var date = new Date(timestamp * 1000);
// Get Month
var month = date.getMonth() + 1;
// Get Day
var day = date.getDate();
// Get year
var year = date.getFullYear();
// Get hours
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
// Get Minutes
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
if (returnTime) {
return month + "/" + day + "/" + year + " " + hours + ":" + minutes;
}
else {
return month + "/" + day + "/" + year;
}
};
exports.formatDate = formatDate;
var isEmptyObject = function (obj) {
if (Object.entries(obj).length >= 1) {
return false;
}
else {
return true;
}
};
exports.isEmptyObject = isEmptyObject;