@gez/date-time-kit 1.0.3-alpha.28 → 1.0.3-alpha.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.html CHANGED
@@ -31,8 +31,8 @@
31
31
  // event
32
32
  const result = await dataTimeKit.open({
33
33
  root: document.querySelector('#root'),
34
- maxTime: "1990-01-01 00:00:00.000",
35
- minTime: "2050-01-01 23:59:59.999",
34
+ minTime: "1990-01-01 00:00:00.000",
35
+ maxTime: "2050-01-01 23:59:59.999",
36
36
  startTime: rand.startTime,
37
37
  endTime: rand.endTime,
38
38
  timeZone: 2,
package/dist/index.js CHANGED
@@ -142,4 +142,4 @@ var t={757:function(t){t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUi
142
142
  <button class="dt-button dt-button-primary">${o[c.lang].box.confirm}</button>
143
143
  </div>
144
144
  </div>
145
- `),i.appendChild(y);let N=document.createElement("div");if(N.classList.add("dt-mask"),document.body.appendChild(N),window.innerWidth>768){let t=i.getBoundingClientRect();y.style.top=`${t.height+5}px`}let v=l(j);y.insertBefore(v,y.querySelector(".dt-content")),D.push({ele:v,component:e});let h=g(j,"start");y.querySelector(".dt-start").appendChild(h),D.push({ele:h,component:n});let I=E(j,"start");y.querySelector(".dt-start").appendChild(I),D.push({ele:I,component:d});let O=g(j,"end");y.querySelector(".dt-end").appendChild(O),D.push({ele:O,component:n});let x=E(j,"end");y.querySelector(".dt-end").appendChild(x),D.push({ele:x,component:d});let w=b(j);function S(){N.removeEventListener("click",Y),y.removeEventListener("click",p)}function Y(){S(),z(y),z(N),M("cancel")}function p(e){e.stopPropagation();let a=e.target;if(a.classList.contains("dt-button-cancel")&&Y(),a.classList.contains("dt-button-primary")){if(a.classList.contains("dt-button-disabled"))return;!function(){S(),z(y),z(N);let e=A({date:j.startDate,time:j.startTime},j.timeZone),a=A({date:j.endDate,time:j.endTime},j.timeZone),i=L(e.date,e.time),n=L(a.date,a.time);t({startTime:i,endTime:n,quick:m(j),startTimeStamp:new Date(i).getTime(),endTimeStamp:new Date(n).getTime(),timeZone:j.timeZone})}()}}y.querySelector(".dt-time-box").appendChild(w),D.push({ele:w,component:s}),y.addEventListener("click",p),N.addEventListener("click",Y),function(t){t.classList.add("dt-show")}(y)})}async function Z(t){return $({root:t.root},function(t){let{maxTime:e,minTime:a,startTime:i,endTime:n}=t;if(void 0!==t.timeZone){let d=w();e&&(e=Y(e,d,t.timeZone)),a&&(a=Y(a,d,t.timeZone)),i&&(i=Y(i,d,t.timeZone)),n&&(n=Y(n,d,t.timeZone))}let d=new Date(e||Date.now());d.setFullYear(d.getFullYear()+5*!e);let s=new Date(a||Date.now());s.setFullYear(s.getFullYear()-20*!a);let o=new Date(i||Date.now()),M=new Date(n||Date.now()),l=new Date(i||Date.now()),r=new Date(n||Date.now());o.getUTCFullYear()===M.getUTCFullYear()&&l.getMonth()==M.getMonth()&&r.setMonth(M.getMonth()+1);let c=0;return c=void 0!==t.timeZone?t.timeZone:-new Date().getTimezoneOffset()/60,void 0===t.enableZone&&(t.enableZone=!0),{startDate:i?O(o):O(),endDate:n?O(M):O(),startTime:i?x(o):x(),endTime:n?x(M):x(),startDateShow:O(l),endDateShow:O(r),moveDate:O(),maxDate:O(s),maxTime:x(s),minDate:O(d),minTime:x(d),lang:t.lang||"enUS",timeZone:c,granularity:t.granularity||N.day,enableZone:t.enableZone}}(t))}function F(t,a,i){let n=w();void 0===i&&(i=n);let d=new Date(Y(t,n,i)),s=new Date(Y(a,n,i)),o={hour:s.getHours(),minute:s.getMinutes(),second:s.getSeconds(),millisecond:s.getMilliseconds()},M={hour:d.getHours(),minute:d.getMinutes(),second:d.getSeconds(),millisecond:d.getMilliseconds()},l={year:d.getFullYear(),month:d.getMonth()+1,date:d.getDate()},r={year:s.getFullYear(),month:s.getMonth()+1,date:s.getDate()},{QUICK_MAP:c}=e;for(let t in c){var m,u,D,g,T,j,y,N,z,v,h,I,L,O;if(c[t]&&(null===(m=c[t])||void 0===m?void 0:m.endTime.hour)===o.hour&&(null===(u=c[t])||void 0===u?void 0:u.endTime.minute)===o.minute&&(null===(D=c[t])||void 0===D?void 0:D.endTime.second)===o.second&&(null===(g=c[t])||void 0===g?void 0:g.endTime.millisecond)===o.millisecond&&(null===(T=c[t])||void 0===T?void 0:T.startTime.hour)===M.hour&&(null===(j=c[t])||void 0===j?void 0:j.startTime.minute)===M.minute&&(null===(y=c[t])||void 0===y?void 0:y.startTime.second)===M.second&&(null===(N=c[t])||void 0===N?void 0:N.startTime.millisecond)===M.millisecond&&(null===(z=c[t])||void 0===z?void 0:z.startDate.year)===l.year&&(null===(v=c[t])||void 0===v?void 0:v.startDate.month)===l.month&&(null===(h=c[t])||void 0===h?void 0:h.startDate.date)===l.date&&(null===(I=c[t])||void 0===I?void 0:I.endDate.year)===r.year&&(null===(L=c[t])||void 0===L?void 0:L.endDate.month)===r.month&&(null===(O=c[t])||void 0===O?void 0:O.endDate.date)===r.date)return t}return null}function P(t,a){let i={startTime:"0000-00-00 00:00:00.000",endTime:"0000-00-00 00:00:00.000",startTimeStamp:0,endTimeStamp:0},{QUICK_MAP:n}=e;if(!n[t])return i;void 0===a&&(a=w());let d=A({date:n[t].startDate,time:n[t].startTime},a),s=A({date:n[t].endDate,time:n[t].endTime},a);return i.startTime=L(d.date,d.time),i.endTime=L(s.date,s.time),i.startTimeStamp=new Date(i.startTime).getTime(),i.endTimeStamp=new Date(i.endTime).getTime(),i}a(406),a(276);let q={open:Z,getLimitKeyByTimetamp:F,getTimestampByLimitKey:P,getTimeStringByTimestamp:function(t){let e=new Date(t);return`${v(e.getFullYear(),e.getMonth()+1,e.getDate())} ${h(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}`},getTimeStringByTimeZone:Y}})();var n=i.ZP,d=i.sM,s=i.rC,o=i.bA;export{n as default,d as getLimitKeyByTimetamp,s as getTimestampByLimitKey,o as open};
145
+ `),i.appendChild(y);let N=document.createElement("div");if(N.classList.add("dt-mask"),document.body.appendChild(N),window.innerWidth>768){let t=i.getBoundingClientRect();y.style.top=`${t.height+5}px`}let v=l(j);y.insertBefore(v,y.querySelector(".dt-content")),D.push({ele:v,component:e});let h=g(j,"start");y.querySelector(".dt-start").appendChild(h),D.push({ele:h,component:n});let I=E(j,"start");y.querySelector(".dt-start").appendChild(I),D.push({ele:I,component:d});let O=g(j,"end");y.querySelector(".dt-end").appendChild(O),D.push({ele:O,component:n});let x=E(j,"end");y.querySelector(".dt-end").appendChild(x),D.push({ele:x,component:d});let w=b(j);function S(){N.removeEventListener("click",Y),y.removeEventListener("click",p)}function Y(){S(),z(y),z(N),M("cancel")}function p(e){e.stopPropagation();let a=e.target;if(a.classList.contains("dt-button-cancel")&&Y(),a.classList.contains("dt-button-primary")){if(a.classList.contains("dt-button-disabled"))return;!function(){S(),z(y),z(N);let e=A({date:j.startDate,time:j.startTime},j.timeZone),a=A({date:j.endDate,time:j.endTime},j.timeZone),i=L(e.date,e.time),n=L(a.date,a.time);t({startTime:i,endTime:n,quick:m(j),startTimeStamp:new Date(i).getTime(),endTimeStamp:new Date(n).getTime(),timeZone:j.timeZone})}()}}y.querySelector(".dt-time-box").appendChild(w),D.push({ele:w,component:s}),y.addEventListener("click",p),N.addEventListener("click",Y),function(t){t.classList.add("dt-show")}(y)})}async function Z(t){return $({root:t.root},function(t){let{maxTime:e,minTime:a,startTime:i,endTime:n}=t,d=e;if(e=a,a=d,void 0!==t.timeZone){let d=w();e&&(e=Y(e,d,t.timeZone)),a&&(a=Y(a,d,t.timeZone)),i&&(i=Y(i,d,t.timeZone)),n&&(n=Y(n,d,t.timeZone))}let s=new Date(e||Date.now());s.setFullYear(s.getFullYear()+5*!e);let o=new Date(a||Date.now());o.setFullYear(o.getFullYear()-20*!a);let M=new Date(i||Date.now()),l=new Date(n||Date.now()),r=new Date(i||Date.now()),c=new Date(n||Date.now());M.getUTCFullYear()===l.getUTCFullYear()&&r.getMonth()==l.getMonth()&&c.setMonth(l.getMonth()+1);let m=0;return m=void 0!==t.timeZone?t.timeZone:-new Date().getTimezoneOffset()/60,void 0===t.enableZone&&(t.enableZone=!0),{startDate:i?O(M):O(),endDate:n?O(l):O(),startTime:i?x(M):x(),endTime:n?x(l):x(),startDateShow:O(r),endDateShow:O(c),moveDate:O(),maxDate:O(o),maxTime:x(o),minDate:O(s),minTime:x(s),lang:t.lang||"enUS",timeZone:m,granularity:t.granularity||N.day,enableZone:t.enableZone}}(t))}function F(t,a,i){let n=w();void 0===i&&(i=n);let d=new Date(Y(t,n,i)),s=new Date(Y(a,n,i)),o={hour:s.getHours(),minute:s.getMinutes(),second:s.getSeconds(),millisecond:s.getMilliseconds()},M={hour:d.getHours(),minute:d.getMinutes(),second:d.getSeconds(),millisecond:d.getMilliseconds()},l={year:d.getFullYear(),month:d.getMonth()+1,date:d.getDate()},r={year:s.getFullYear(),month:s.getMonth()+1,date:s.getDate()},{QUICK_MAP:c}=e;for(let t in c){var m,u,D,g,T,j,y,N,z,v,h,I,L,O;if(c[t]&&(null===(m=c[t])||void 0===m?void 0:m.endTime.hour)===o.hour&&(null===(u=c[t])||void 0===u?void 0:u.endTime.minute)===o.minute&&(null===(D=c[t])||void 0===D?void 0:D.endTime.second)===o.second&&(null===(g=c[t])||void 0===g?void 0:g.endTime.millisecond)===o.millisecond&&(null===(T=c[t])||void 0===T?void 0:T.startTime.hour)===M.hour&&(null===(j=c[t])||void 0===j?void 0:j.startTime.minute)===M.minute&&(null===(y=c[t])||void 0===y?void 0:y.startTime.second)===M.second&&(null===(N=c[t])||void 0===N?void 0:N.startTime.millisecond)===M.millisecond&&(null===(z=c[t])||void 0===z?void 0:z.startDate.year)===l.year&&(null===(v=c[t])||void 0===v?void 0:v.startDate.month)===l.month&&(null===(h=c[t])||void 0===h?void 0:h.startDate.date)===l.date&&(null===(I=c[t])||void 0===I?void 0:I.endDate.year)===r.year&&(null===(L=c[t])||void 0===L?void 0:L.endDate.month)===r.month&&(null===(O=c[t])||void 0===O?void 0:O.endDate.date)===r.date)return t}return null}function P(t,a){let i={startTime:"0000-00-00 00:00:00.000",endTime:"0000-00-00 00:00:00.000",startTimeStamp:0,endTimeStamp:0},{QUICK_MAP:n}=e;if(!n[t])return i;void 0===a&&(a=w());let d=A({date:n[t].startDate,time:n[t].startTime},a),s=A({date:n[t].endDate,time:n[t].endTime},a);return i.startTime=L(d.date,d.time),i.endTime=L(s.date,s.time),i.startTimeStamp=new Date(i.startTime).getTime(),i.endTimeStamp=new Date(i.endTime).getTime(),i}a(406),a(276);let q={open:Z,getLimitKeyByTimetamp:F,getTimestampByLimitKey:P,getTimeStringByTimestamp:function(t){let e=new Date(t);return`${v(e.getFullYear(),e.getMonth()+1,e.getDate())} ${h(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}`},getTimeStringByTimeZone:Y}})();var n=i.ZP,d=i.sM,s=i.rC,o=i.bA;export{n as default,d as getLimitKeyByTimetamp,s as getTimestampByLimitKey,o as open};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gez/date-time-kit",
3
- "version": "1.0.3-alpha.28",
3
+ "version": "1.0.3-alpha.29",
4
4
  "description": "A JavaScript library for handling date and time operations efficiently.",
5
5
  "type": "module",
6
6
  "types": "type.d.ts",