![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /var/www/html/libs/absol-full/dist/js/ |
Upload File : |
/*** module: node_modules/absol-sheet/js/fx/ExcelFx.js ***/ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DATE = DATE; exports.YEAR = YEAR; exports.MONTH = MONTH; exports.DAY = DAY; exports.DAYS = DAYS; exports.TODAY = TODAY; exports.NOW = NOW; exports.DATEDIF = DATEDIF; exports.MAX = MAX; exports.MIN = MIN; exports.SUM = SUM; exports.IF = IF; exports.MATCH = MATCH; exports.CHOOSE = CHOOSE; exports.CTAN = exports.TAN = exports.COS = exports.SIN = void 0; var _datetime = require("absol/src/Time/datetime"); function DATE(year, month, day) { var tYear = typeof year; var tMonth = typeof month; var tDay = typeof day; if (tYear !== "number" && tMonth !== 'number' && tDay !== "number") return undefined; if (tYear !== 'number') tYear = new Date().getFullYear(); if (typeof month !== 'number') month = 1; if (typeof day !== 'number') day = 1; month = Math.max(1, Math.min(12, month << 0)); var dim = (0, _datetime.daysInMonth)(year, month - 1); day = Math.max(1, Math.min(dim, day << 0)); return new Date(year, month - 1, day); } function YEAR(date) { if (typeof date === "number" || typeof date === "string") date = new Date(date); if (date && date.getFullYear) return date.getFullYear(); return undefined; } function MONTH(date) { if (typeof date === "number" || typeof date === "string") date = new Date(date); if (date && date.getMonth) return date.getMonth() + 1; return undefined; } function DAY(date) { if (typeof date === "number" || typeof date === "string") date = new Date(date); if (date && date.getDate) return date.getDate(); return undefined; } function DAYS(end_date, start_date) {//todo } function TODAY() { return (0, _datetime.beginOfDay)(new Date()); } function NOW() { return new Date(); } function DATEDIF(d1, d2, df) { if (!d1 || !d2) { return undefined; } if (typeof d1 === "number" || typeof d1 === "string") d1 = new Date(d1); if (typeof d2 === "number" || typeof d2 === "string") d2 = new Date(d2); if (!d1.getFullYear || isNaN(d1.getFullYear())) return undefined; if (!d2.getFullYear || isNaN(d2.getFullYear())) return undefined; df = df || 'D'; switch (df) { case 'D': return (0, _datetime.compareDate)(d2, d1); case 'M': return (0, _datetime.compareMonth)(d2, d1); case 'Y': return d2.getFullYear() - d1.getFullYear(); default: return undefined; } } function MAX(args) { var res; if (arguments.length === 0) { res = undefined; } else if (arguments.length === 1) { if (typeof args === "number") { res = args; } else if (args instanceof Array) { res = args.reduce((ac, x) => Math.max(ac, x), -Infinity); res = res === -Infinity ? undefined : res; } } return res; } function MIN(args) { var res; if (arguments.length === 0) { res = undefined; } else if (arguments.length === 1) { if (typeof args === "number") { res = args; } else if (args instanceof Array) { res = args.reduce((ac, x) => Math.min(ac, x), Infinity); res = res === Infinity ? undefined : res; } } return res; } var SIN = Math.sin.bind(Math); exports.SIN = SIN; var COS = Math.cos.bind(Math); exports.COS = COS; var TAN = Math.tan.bind(Math); exports.TAN = TAN; var CTAN = function (x) { return 1 / TAN(x); }; exports.CTAN = CTAN; function SUM(args) { var res; if (arguments.length === 0) { res = 0; } else if (arguments.length === 1) { if (typeof args === "number") { res = args; } else if (args instanceof Array) { res = args.reduce((ac, x) => { return ac + x; }, 0); } } else { res = Array.prototype.reduce.call(arguments, (ac, x) => SUM(x), 0); } if (isNaN(res)) res = undefined; return res; } function IF(condition, ifTrue, ifFalse) { return condition ? ifTrue : ifFalse; } function MATCH(lookup_value, lookup_array, match_type) { if (!(lookup_array instanceof Array)) return undefined; //todo } function CHOOSE(index_num, args) { if (arguments.length < 2) return undefined; if (arguments.length === 2) { if (args instanceof Array) { return args[index_num - 1]; } else return arguments[index_num]; } return arguments[index_num]; }