From 65f9722b3a7c12a13dbe111597109494b59e1f83 Mon Sep 17 00:00:00 2001 From: Sebastian Klatte Date: Tue, 10 Jun 2014 00:57:06 +0200 Subject: [PATCH] more compact _hour function --- js/calendar.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/js/calendar.js b/js/calendar.js index 6b1880c2..658eefc5 100644 --- a/js/calendar.js +++ b/js/calendar.js @@ -530,15 +530,10 @@ if(!String.prototype.formatNum) { Calendar.prototype._hour = function(hour, part) { var time_start = this.options.time_start.split(":"); var time_split = parseInt(this.options.time_split); - var time_start_h = parseInt(time_start[0]); - var time_start_m = parseInt(time_start[1]); + var h = "" + (parseInt(time_start[0]) + hour * Math.max(time_split / 60, 1)); + var m = "" + (time_split * part + (hour == 0) ? parseInt(time_start[1]) : 0); - var r_h = time_start_h + hour * Math.max(time_split / 60, 1); - var r_m = time_split * part; - if((hour == 0)) - r_m += time_start_m; - - return r_h.toString().formatNum(2) + ":" + r_m.toString().formatNum(2); + return h.formatNum(2) + ":" + m.formatNum(2); }; Calendar.prototype._week = function(event) {