@gez/date-time-kit 1.0.3-alpha.10 → 1.0.3-alpha.13

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.js CHANGED
@@ -140,4 +140,4 @@ var t={757:function(t){t.exports="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTUi
140
140
  <button class="dt-button dt-button-primary">${s[u.lang].box.confirm}</button>
141
141
  </div>
142
142
  </div>
143
- `),o.appendChild(N);let z=document.createElement("div");if(z.classList.add("dt-mask"),document.body.appendChild(z),window.innerWidth>768){let t=o.getBoundingClientRect();N.style.top=`${t.height+5}px`}let v=M(j);N.insertBefore(v,N.querySelector(".dt-content")),g.push({ele:v,component:t});let I=D(j,"start");N.querySelector(".dt-start").appendChild(I),g.push({ele:I,component:e});let L=S(j,"start");N.querySelector(".dt-start").appendChild(L),g.push({ele:L,component:n});let O=D(j,"end");N.querySelector(".dt-end").appendChild(O),g.push({ele:O,component:e});let x=S(j,"end");N.querySelector(".dt-end").appendChild(x),g.push({ele:x,component:n});let w=E(j);function A(){z.removeEventListener("click",Y),N.removeEventListener("click",p)}function Y(){A(),y(N),y(z),l("cancel")}function p(t){t.stopPropagation();let e=t.target;e.classList.contains("dt-button-cancel")&&Y(),e.classList.contains("dt-button-primary")&&function(){A(),y(N),y(z);let t=h(j.startDate,j.startTime),e=h(j.endDate,j.endTime);a({startTime:t,endTime:e,quick:c(j),startTimeStamp:new Date(t).getTime(),endTimeStamp:new Date(e).getTime(),timeZone:j.timeZone})}()}N.querySelector(".dt-time-box").appendChild(w),g.push({ele:w,component:d}),N.addEventListener("click",p),z.addEventListener("click",Y),function(t){t.classList.add("dt-show")}(N)})}async function $(t){return Q({root:t.root},function(t){let{maxTime:e,minTime:a,startTime:i,endTime:n}=t;t.timeZone&&(L(),e&&(e=w(e,t.timeZone)),a&&(a=w(a,t.timeZone)),i&&(i=w(i,t.timeZone)),n&&(n=w(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?v(o):v(),endDate:n?v(M):v(),startTime:i?I(o):I(),endTime:n?I(M):I(),startDateShow:v(l),endDateShow:v(r),moveDate:v(),maxDate:v(s),maxTime:I(s),minDate:v(d),minTime:I(d),lang:t.lang||"enUS",timeZone:c}}(t))}function Z(e,a,i){let n=L();i||(i=n);let d=new Date(w(e,i,n)),s=new Date(w(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}=t;for(let t in c){var u,m,D,g,T,j,y,N,z,h,v,I,O,x;if(c[t]&&(null===(u=c[t])||void 0===u?void 0:u.endTime.hour)===o.hour&&(null===(m=c[t])||void 0===m?void 0:m.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===(O=c[t])||void 0===O?void 0:O.endDate.month)===r.month&&(null===(x=c[t])||void 0===x?void 0:x.endDate.date)===r.date)return t}return null}function F(e,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}=t;if(!n[e])return i;a||(a=L());let d=x({date:n[e].startDate,time:n[e].startTime},a),s=x({date:n[e].endDate,time:n[e].endTime},a);return i.startTime=h(d.date,d.time),i.endTime=h(s.date,s.time),i.startTimeStamp=new Date(i.startTime).getTime(),i.endTimeStamp=new Date(i.endTime).getTime(),i}a(611),a(803),a(406),a(276);let P={open:$,getLimitKeyByTimetamp:Z,getTimestampByLimitKey:F,getTimeStringByTimestamp:function(t){let e=new Date(t);return`${N(e.getFullYear(),e.getMonth()+1,e.getDate())} ${z(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}`}}})();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};
143
+ `),o.appendChild(N);let z=document.createElement("div");if(z.classList.add("dt-mask"),document.body.appendChild(z),window.innerWidth>768){let t=o.getBoundingClientRect();N.style.top=`${t.height+5}px`}let v=M(j);N.insertBefore(v,N.querySelector(".dt-content")),g.push({ele:v,component:t});let I=D(j,"start");N.querySelector(".dt-start").appendChild(I),g.push({ele:I,component:e});let L=S(j,"start");N.querySelector(".dt-start").appendChild(L),g.push({ele:L,component:n});let O=D(j,"end");N.querySelector(".dt-end").appendChild(O),g.push({ele:O,component:e});let x=S(j,"end");N.querySelector(".dt-end").appendChild(x),g.push({ele:x,component:n});let w=E(j);function A(){z.removeEventListener("click",Y),N.removeEventListener("click",p)}function Y(){A(),y(N),y(z),l("cancel")}function p(t){t.stopPropagation();let e=t.target;e.classList.contains("dt-button-cancel")&&Y(),e.classList.contains("dt-button-primary")&&function(){A(),y(N),y(z);let t=h(j.startDate,j.startTime),e=h(j.endDate,j.endTime);a({startTime:t,endTime:e,quick:c(j),startTimeStamp:new Date(t).getTime(),endTimeStamp:new Date(e).getTime(),timeZone:j.timeZone})}()}N.querySelector(".dt-time-box").appendChild(w),g.push({ele:w,component:d}),N.addEventListener("click",p),z.addEventListener("click",Y),function(t){t.classList.add("dt-show")}(N)})}async function $(t){return Q({root:t.root},function(t){let{maxTime:e,minTime:a,startTime:i,endTime:n}=t;t.timeZone&&(L(),e&&(e=w(e,t.timeZone)),a&&(a=w(a,t.timeZone)),i&&(i=w(i,t.timeZone)),n&&(n=w(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?v(o):v(),endDate:n?v(M):v(),startTime:i?I(o):I(),endTime:n?I(M):I(),startDateShow:v(l),endDateShow:v(r),moveDate:v(),maxDate:v(s),maxTime:I(s),minDate:v(d),minTime:I(d),lang:t.lang||"enUS",timeZone:c}}(t))}function Z(e,a,i){let n=L();i||(i=n);let d=new Date(w(e,i,n)),s=new Date(w(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}=t;for(let t in c){var u,m,D,g,T,j,y,N,z,h,v,I,O,x;if(c[t]&&(null===(u=c[t])||void 0===u?void 0:u.endTime.hour)===o.hour&&(null===(m=c[t])||void 0===m?void 0:m.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===(O=c[t])||void 0===O?void 0:O.endDate.month)===r.month&&(null===(x=c[t])||void 0===x?void 0:x.endDate.date)===r.date)return t}return null}function F(e,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}=t;if(!n[e])return i;a||(a=L());let d=x({date:n[e].startDate,time:n[e].startTime},a),s=x({date:n[e].endDate,time:n[e].endTime},a);return i.startTime=h(d.date,d.time),i.endTime=h(s.date,s.time),i.startTimeStamp=new Date(i.startTime).getTime(),i.endTimeStamp=new Date(i.endTime).getTime(),i}a(611),a(803),a(406),a(276);let P={open:$,getLimitKeyByTimetamp:Z,getTimestampByLimitKey:F,getTimeStringByTimestamp:function(t){let e=new Date(t);return`${N(e.getFullYear(),e.getMonth()+1,e.getDate())} ${z(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}`},getTimeStringByTimeZone:w}})();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.10",
3
+ "version": "1.0.3-alpha.13",
4
4
  "description": "A JavaScript library for handling date and time operations efficiently.",
5
5
  "type": "module",
6
6
  "types": "type.d.ts",
package/type.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
 
2
2
 
3
3
  export declare function open(kitOpiton: kitOption): Promise<kitResult>;
4
- export declare function getLimitKeyByTimetamp(startTimestamp: timeString, endTimestamp: timeString, timeZone: number | undefined): kitDataLimit | null;
5
- export declare function getTimestampByLimitKey(limit: kitDataLimit, timeZone: number | undefined): kitTimestampResult;
4
+ export declare function getLimitKeyByTimetamp(startTimestamp: timeString, endTimestamp: timeString, timeZone?: number | undefined): kitDataLimit | null;
5
+ export declare function getTimestampByLimitKey(limit: kitDataLimit, timeZone?: number | undefined): kitTimestampResult;
6
6
  export declare function getTimeStringByTimestamp(timestamp: number): timeString;
7
-
7
+ export declare function getTimeStringByTimeZone(timeString: timeString, timeZone: number, currentTimeZone?: number): timeString;
8
8
  export interface kitTimestampResult {
9
9
  startTime: timeString,
10
10
  endTime: timeString,