@@ -0,0 +1 @@
|
||||
const E={forenoon1:"08:00",forenoon2:"12:00",afternoon1:"13:00",afternoon2:"17:00"};function M(t){const[n,r]=String(t).split(":").map(e=>parseInt(e,10));return(n||0)*60+(r||0)}function h(t){if(!t)return null;const n=t.trim().replace("T"," "),[r,e="00:00"]=n.split(" "),[o,s,a]=r.split("-").map(c=>parseInt(c,10)),[i,u]=e.split(":").map(c=>parseInt(c,10));return!o||!s||!a?null:new Date(o,s-1,a,i||0,u||0,0,0)}function x(t,n){const r=new Date(t.getFullYear(),t.getMonth(),t.getDate()),e=new Date(n.getFullYear(),n.getMonth(),n.getDate());return Math.round((e.getTime()-r.getTime())/864e5)}function T(t,n,r,e,o){return t<n?n:t<=r?t:t<e?e:t>o?o:t}function y(t,n,r,e,o){return t<n?n:t<=r?t:t<e?r:t>o?o:t}function H(t,n,r=E){const e=h(t),o=h(n);if(!e||!o||o.getTime()<=e.getTime())return null;const s=M(r.forenoon1),a=M(r.forenoon2),i=M(r.afternoon1),u=M(r.afternoon2),c=Math.max(0,i-a),N=Math.max(0,a-s)+Math.max(0,u-i),d=e.getHours()*60+e.getMinutes(),D=o.getHours()*60+o.getMinutes();let p;if(x(e,o)===0){const f=T(d,s,a,i,u),l=y(D,s,a,i,u);let m=l-f;f<=a&&l>=i&&(m-=c),p=Math.max(0,m)}else{const f=T(d,s,a,i,u),l=y(D,s,a,i,u);let m=Math.max(0,u-f);f<=a&&(m-=c);let g=Math.max(0,l-s);l>=i&&(g-=c);const w=Math.max(0,x(e,o)-1);p=Math.max(0,m)+Math.max(0,g)+w*N}return Math.round(p/60*100)/100}function I(t){if(t==null||isNaN(Number(t)))return"-";const n=Math.round(Number(t)*100)/100;return String(n).replace(/\.0+$/,"")}export{E as D,H as c,I as t};
|
||||
Reference in New Issue
Block a user