Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- format: function(timespan, format) {
- if (!timespan)
- return "N/A";
- switch (format) {
- case "d": return Math.ceil(timespan / slworx.timespan.ticks.day);
- case "dhm":
- var segments = [];
- $.each({
- d: Math.floor(timespan / slworx.timespan.ticks.day),
- h: Math.floor(timespan / slworx.timespan.ticks.hour) % 60,
- m: Math.floor(timespan / slworx.timespan.ticks.minute) % 60
- }, function(key, value) {
- if (value)
- segments.push(value + key);
- });
- return segments.join(" ");
- case "hm":
- var segments = [];
- $.each({
- h: Math.floor(timespan / slworx.timespan.ticks.hour) % 60,
- m: Math.floor(timespan / slworx.timespan.ticks.minute) % 60
- }, function(key, value) {
- if (value)
- segments.push(value + key);
- });
- return segments.join(" ");
- case "hh:mmtt": return slworx.date.format(new Date().setTime(timespan), format);
- }
Add Comment
Please, Sign In to add comment