uawdijnntqw1x1x1
IP : 3.145.10.222
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
axolotl.ru
/
www
/
bitrix
/
lib
/
functions
/
..
/
..
/
js
/
tasks
/
task-calendar.min.js
/
/
BX.namespace("BX.Tasks");BX.Tasks.Calendar=function(){function t(t){this.weekends={0:true,6:true};this.holidays={};this.worktime=[{start:{hours:0,minutes:0},end:{hours:24,minutes:0}}];this.setWeekends(t.weekEnds);this.setHolidays(t.holidays);this.setWorkTime(t.worktime)}t.adaptSettings=function(t){var e={};if(BX.type.isPlainObject(t)){var r=t.HOURS;var n=t.WEEKEND;var a={MO:1,TU:2,WE:3,TH:4,FR:5,SA:6,SU:0};var s=function(t){t=t.toString();if(t.length==0){return"00"}if(t.length==1){return"0"+t}return t};e.worktime=s(r.START.H)+":"+s(r.START.M)+"-"+s(r.END.H)+":"+s(r.END.M);e.weekEnds=[];BX.Tasks.each(n,function(t){e.weekEnds.push(a[t])});e.weekStart=a[t.WEEK_START];e.holidays=[];for(var i in t.HOLIDAYS){e.holidays.push({month:parseInt(t.HOLIDAYS[i].M)-1,day:parseInt(t.HOLIDAYS[i].D)})}}return e};t.prototype.getClosestWorkTime=function(t,e){var r=e?t:null;var n=e?null:t;this.processEachDay(r,n,e,function(r,n){t=e?r:n;return false});return new Date(t.getTime())};t.prototype.calculateDuration=function(t,e){var r=0;if(t<e){this.processEachDay(t,e,true,function(t,e){r+=e-t})}else{this.processEachDay(e,t,true,function(t,e){r-=e-t})}return r};t.prototype.calculateStartDate=function(t,e){var r=null;this.processEachDay(null,t,false,function(t,n){var a=n-t;if(a>=e){r=new Date(n.getTime()-e);return false}else{e-=a}});return r};t.prototype.calculateEndDate=function(t,e){var r=null;this.processEachDay(t,null,true,function(t,n){var a=n-t;if(a>=e){r=new Date(t.getTime()+e);return false}else{e-=a}});return r};t.prototype.processEachDay=function(t,e,r,n){var a=new Date(r?t.getTime():e.getTime());var s=r?!e:!t;while(s||(r?a<e:a>t)){var i=this.getWorkHours(a);for(var o=r?0:i.length-1;r?o<i.length:o>=0;r?o++:o--){var u=i[o];var l=u.startDate;var h=u.endDate;if(e!==null&&l>e||t!==null&&h<t){continue}var f=t!==null&&l<t?t:l;var p=e!==null&&h>e?e:h;if(n.call(this,f,p)===false){return false}}a=BX.Tasks.Date.add(BX.Tasks.Date.floorDate(a,BX.Tasks.Date.Unit.Day),BX.Tasks.Date.Unit.Day,r?1:-1)}};t.prototype.getWorkHours=function(t){var e=[];if(this.isWeekend(t)||this.isHoliday(t)){return e}return this.getWorkIntervals(t)};t.prototype.getWorkIntervals=function(t){var e=t.getUTCFullYear();var r=t.getUTCMonth();var n=t.getUTCDate();var a=[];for(var s=0;s<this.worktime.length;s++){var i=this.worktime[s];a.push({startDate:new Date(Date.UTC(e,r,n,i.start.hours,i.start.minutes)),endDate:new Date(Date.UTC(e,r,n,i.end.hours,i.end.minutes))})}return a};t.prototype.getWorkDayDuration=function(){var t=0;var e=this.getWorkIntervals(new Date);for(var r=0;r<e.length;r++){t+=e[r].endDate-e[r].startDate}return t};t.prototype.isWorkTime=function(t){if(this.isWeekend(t)||this.isHoliday(t)){return false}var e=null;this.processEachDay(t,null,true,function(r,n){e=t>=r&&t<=n;return false});return e};t.prototype.isHoliday=function(t){var e=t.getUTCMonth();var r=t.getUTCDate();return this.holidays[e+"_"+r]?true:false};t.prototype.isWeekend=function(t){var e=t.getUTCDay();return this.weekends[e]?true:false};t.prototype.setWeekends=function(t){if(!BX.type.isArray(t)){return}this.weekends={};for(var e=0;e<t.length;e++){var r=t[e];if(r>=0&&r<=6){this.weekends[r]=true}}};t.prototype.setHolidays=function(t){if(!BX.type.isArray(t)){return}this.holidays={};for(var e=0;e<t.length;e++){var r=t[e];var n=BX.type.isNumber(r.month)&&r.month>=0&&r.month<=11;var a=BX.type.isNumber(r.day)&&r.month>=0&&r.month<=31;if(n&&a){this.holidays[r.month+"_"+r.day]=true}}};t.prototype.setWorkTime=function(t){if(BX.type.isNotEmptyString(t)){t=[t]}if(!BX.type.isArray(t)){return}var e=[];for(var r=0;r<t.length;r++){var n=t[r];var a=/(\d\d):(\d\d)-(\d\d):(\d\d)/;var s=a.exec(n);if(!s){continue}var i=parseInt(s[1],10);var o=parseInt(s[2],10);var u=parseInt(s[3],10);var l=parseInt(s[4],10);e.push({start:{hours:i,minutes:o,time:i*60+o},end:{hours:u,minutes:l,time:u*60+l}})}if(this.isWorkTimeCorrect(e)){this.worktime=e}};t.prototype.isWorkTimeCorrect=function(t){if(!t.length){return false}t.sort(function(t,e){return t.start.time-e.start.time});for(var e=0;e<t.length;e++){var r=t[e];if(r.start.hours<0||r.start.hours>23||r.end.hours<0||r.end.hours>24){return false}if(r.start.minutes<0||r.start.minutes>59||r.end.minutes<0||r.end.minutes>59){return false}if(r.start.time>r.end.time){return false}if(e>0){var n=t[e-1];if(n.end.time>r.start.time){return false}}}return true};return t}(); //# sourceMappingURL=task-calendar.map.js
/var/www/axolotl/data/www/axolotl.ru/www/bitrix/lib/functions/../../js/tasks/task-calendar.min.js