summaryrefslogtreecommitdiff
path: root/system/admin/static/common/js
diff options
context:
space:
mode:
Diffstat (limited to 'system/admin/static/common/js')
-rw-r--r--system/admin/static/common/js/util.js32
1 files changed, 20 insertions, 12 deletions
diff --git a/system/admin/static/common/js/util.js b/system/admin/static/common/js/util.js
index 40c9828..cf47af4 100644
--- a/system/admin/static/common/js/util.js
+++ b/system/admin/static/common/js/util.js
@@ -23,34 +23,42 @@ function replaceBadChars(text) {
}
-// Returns a local partial time based on unix timestamp (i.e. HH:MM:SS)
+// Returns a local partial time object based on unix timestamp
function getPartialTime(unix) {
var date = new Date(unix);
- var parts = [];
- parts.push(date.getHours());
- parts.push(date.getMinutes());
- parts.push(date.getSeconds());
+ var t = {};
+ var hours = date.getHours();
+ if (hours < 10) {
+ hours = "0" + String(hours);
+ }
+ t.hh = hours;
+
+ var minutes = date.getMinutes();
+ if (minutes < 10) {
+ minutes = "0" + String(minutes);
+ }
+ t.mm = minutes;
- return parts.join(":");
+ return t;
}
-// Returns a local partial date based on unix timestamp (YYYY-MM-DD)
+// Returns a local partial date object based on unix timestamp
function getPartialDate(unix) {
var date = new Date(unix);
- var parts = [];
- parts.push(date.getFullYear());
+ var d = {};
+ d.yyyy = date.getFullYear();
var month = date.getMonth()+1;
if (month < 10) {
month = "0" + String(month);
}
- parts.push(month);
+ d.mm = month;
var day = date.getDate();
if (day < 10) {
day = "0" + String(day);
}
- parts.push(day);
+ d.dd = day;
- return parts.join("-");
+ return d;
} \ No newline at end of file