Guest User

Untitled

a guest
Apr 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. format: function(timespan, format) {
  2. if (!timespan)
  3. return "N/A";
  4.  
  5. switch (format) {
  6. case "d": return Math.ceil(timespan / slworx.timespan.ticks.day);
  7. case "dhm":
  8. var segments = [];
  9. $.each({
  10. d: Math.floor(timespan / slworx.timespan.ticks.day),
  11. h: Math.floor(timespan / slworx.timespan.ticks.hour) % 60,
  12. m: Math.floor(timespan / slworx.timespan.ticks.minute) % 60
  13. }, function(key, value) {
  14. if (value)
  15. segments.push(value + key);
  16. });
  17. return segments.join(" ");
  18. case "hm":
  19. var segments = [];
  20. $.each({
  21. h: Math.floor(timespan / slworx.timespan.ticks.hour) % 60,
  22. m: Math.floor(timespan / slworx.timespan.ticks.minute) % 60
  23. }, function(key, value) {
  24. if (value)
  25. segments.push(value + key);
  26. });
  27. return segments.join(" ");
  28. case "hh:mmtt": return slworx.date.format(new Date().setTime(timespan), format);
  29.  
  30. }
Add Comment
Please, Sign In to add comment