@gez/date-time-kit 1.0.3-alpha.17 → 1.0.3-alpha.18

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
@@ -21,22 +21,23 @@
21
21
  // import dataTimeKit from './index.ts';
22
22
  const dataTimeKit = await import('./index.js');
23
23
 
24
- // const rand = dataTimeKit.getTimestampByLimitKey('last7Days', 2);
25
- // const keyName = dataTimeKit.getLimitKeyByTimetamp(rand.startTime, rand.endTime, 2);
24
+ const rand = dataTimeKit.getTimestampByLimitKey('last7Days', 2);
25
+ const keyName = dataTimeKit.getLimitKeyByTimetamp(rand.startTime, rand.endTime, 2);
26
26
 
27
- // console.log(rand, keyName);
27
+ console.log(rand, keyName);
28
28
 
29
29
  console.log(dataTimeKit.default.getTimeStringByTimeZone('2025-02-27 00:00:00.000', 9));
30
30
  // event
31
- // dataTimeKit.open({
32
- // root: document.querySelector('#root'),
33
- // maxTime: "1990-01-01 00:00:00.000",
34
- // minTime: "2050-01-01 23:59:59.999",
35
- // startTime: rand.startTime,
36
- // endTime: rand.endTime,
37
- // timeZone: 2,
38
- // lang: 'zhCN'
39
- // });
31
+ const result = await dataTimeKit.open({
32
+ root: document.querySelector('#root'),
33
+ maxTime: "1990-01-01 00:00:00.000",
34
+ minTime: "2050-01-01 23:59:59.999",
35
+ startTime: rand.startTime,
36
+ endTime: rand.endTime,
37
+ timeZone: 2,
38
+ lang: 'zhCN'
39
+ });
40
+ console.log(result);
40
41
 
41
42
  // document.querySelector('#select').addEventListener('click', async (e) => {
42
43
  // e.stopPropagation();
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 h=l(j);y.insertBefore(h,y.querySelector(".dt-content")),D.push({ele:h,component:e});let v=g(j,"start");y.querySelector(".dt-start").appendChild(v),D.push({ele:v,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",A),y.removeEventListener("click",Y)}function A(){S(),z(y),z(N),M("cancel")}function Y(e){e.stopPropagation();let a=e.target;a.classList.contains("dt-button-cancel")&&A(),a.classList.contains("dt-button-primary")&&function(){S(),z(y),z(N);let e=L(j.startDate,j.startTime),a=L(j.endDate,j.endTime);t({startTime:e,endTime:a,quick:m(j),startTimeStamp:new Date(e).getTime(),endTimeStamp:new Date(a).getTime(),timeZone:j.timeZone})}()}y.querySelector(".dt-time-box").appendChild(w),D.push({ele:w,component:s}),y.addEventListener("click",Y),N.addEventListener("click",A),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;t.timeZone&&(w(),e&&(e=Y(e,t.timeZone)),a&&(a=Y(a,t.timeZone)),i&&(i=Y(i,t.timeZone)),n&&(n=Y(n,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,{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}}(t))}function F(t,a,i){let n=w();i||(i=n);let d=new Date(Y(t,i,n)),s=new Date(Y(a,i,n)),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,h,v,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===(h=c[t])||void 0===h?void 0:h.startDate.month)===l.month&&(null===(v=c[t])||void 0===v?void 0:v.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;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 G={open:Z,getLimitKeyByTimetamp:F,getTimestampByLimitKey:P,getTimeStringByTimestamp:function(t){let e=new Date(t);return`${h(e.getFullYear(),e.getMonth()+1,e.getDate())} ${v(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 h=l(j);y.insertBefore(h,y.querySelector(".dt-content")),D.push({ele:h,component:e});let v=g(j,"start");y.querySelector(".dt-start").appendChild(v),D.push({ele:v,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",A),y.removeEventListener("click",Y)}function A(){S(),z(y),z(N),M("cancel")}function Y(e){e.stopPropagation();let a=e.target;a.classList.contains("dt-button-cancel")&&A(),a.classList.contains("dt-button-primary")&&function(){S(),z(y),z(N);let e=L(j.startDate,j.startTime),a=L(j.endDate,j.endTime);t({startTime:e,endTime:a,quick:m(j),startTimeStamp:new Date(e).getTime(),endTimeStamp:new Date(a).getTime(),timeZone:j.timeZone})}()}y.querySelector(".dt-time-box").appendChild(w),D.push({ele:w,component:s}),y.addEventListener("click",Y),N.addEventListener("click",A),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=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,{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}}(t))}function F(t,a,i){let n=w();i||(i=n);let d=new Date(Y(t,i,n)),s=new Date(Y(a,i,n)),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,h,v,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===(h=c[t])||void 0===h?void 0:h.startDate.month)===l.month&&(null===(v=c[t])||void 0===v?void 0:v.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;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 G={open:Z,getLimitKeyByTimetamp:F,getTimestampByLimitKey:P,getTimeStringByTimestamp:function(t){let e=new Date(t);return`${h(e.getFullYear(),e.getMonth()+1,e.getDate())} ${v(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.17",
3
+ "version": "1.0.3-alpha.18",
4
4
  "description": "A JavaScript library for handling date and time operations efficiently.",
5
5
  "type": "module",
6
6
  "types": "type.d.ts",