Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var helpers = {
- mc: function(ts) {
- var s = 1;
- if (["+","-"].indexOf(ts.charAt(0)) != -1) {
- if (ts.charAt(0) == "-") s = -1;
- ts = ts.substring(1);
- }
- var h = parseInt(ts.substring(0, 2));
- var m = parseInt(ts.substring(3, 5));
- return (h >= 0 && m >= 0 && m < 60) ? s * (60 * h + m) : NaN;
- },
- ts: function(M) {
- var d = function(i) { return (i < 10 ? "0" : "") + i };
- M = parseInt(M);
- if (!isNaN(M)) {
- var mi = M < 0;
- M = Math.abs(M);
- var m = parseInt(M / 60);
- var s = M % 60;
- return (mi ? "-" : "") + d(m) + ":" + d(s);
- } else return undefined;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement