Skip to content

Commit

Permalink
more compact _hour function
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Klatte committed Jun 9, 2014
1 parent c24a7f0 commit 65f9722
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions js/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 65f9722

Please sign in to comment.