@gez/date-time-kit 1.0.8 → 1.0.9
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/README.md +4 -4
- package/dist/index.html +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/type.d.ts +1 -1
package/README.md
CHANGED
|
@@ -93,10 +93,10 @@ console.log(result);
|
|
|
93
93
|
```js
|
|
94
94
|
const result = await dataTimeKit.open({
|
|
95
95
|
root: document.getElementById('root'),
|
|
96
|
-
maxTime: "1990-01-
|
|
97
|
-
minTime: "2050-01-
|
|
98
|
-
startTime: "1990-01-
|
|
99
|
-
endTime: "2050-01-
|
|
96
|
+
maxTime: "1990-01-01T00:00:00.000",
|
|
97
|
+
minTime: "2050-01-01T00:00:00.000",
|
|
98
|
+
startTime: "1990-01-01T00:00:00.000",
|
|
99
|
+
endTime: "2050-01-01T00:10:10.022",
|
|
100
100
|
timeZone: 4
|
|
101
101
|
});
|
|
102
102
|
console.log(result);
|
package/dist/index.html
CHANGED
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
|
|
45
45
|
const result = await dataTimeKit.open({
|
|
46
46
|
root: document.querySelector('#root'),
|
|
47
|
-
"minTime": "1990-01-
|
|
48
|
-
"maxTime": "2025-04-
|
|
47
|
+
"minTime": "1990-01-01T00:00:00.000",
|
|
48
|
+
"maxTime": "2025-04-28T18:35:20.894",
|
|
49
49
|
"enableZone": false,
|
|
50
50
|
"granularity": "minute",
|
|
51
51
|
"startTime": rand.startTime,
|
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[m.lang].box.confirm}</button>
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
145
|
-
`),i.appendChild(j);let N=document.createElement("div");if(N.classList.add("dt-mask"),document.body.appendChild(N),window.innerWidth>768){let t=i.getBoundingClientRect();j.style.top=`${t.height+5}px`}let z=r(y);j.insertBefore(z,j.querySelector(".dt-content")),D.push({ele:z,component:e});let v=g(y,"start");j.querySelector(".dt-start").appendChild(v),D.push({ele:v,component:n});let I=k(y,"start");j.querySelector(".dt-start").appendChild(I),D.push({ele:I,component:d});let x=g(y,"end");j.querySelector(".dt-end").appendChild(x),D.push({ele:x,component:n});let O=k(y,"end");j.querySelector(".dt-end").appendChild(O),D.push({ele:O,component:d});let w=b(y);function S(){N.removeEventListener("click",Y),j.removeEventListener("click",p)}function Y(){S(),h(j),h(N),l("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(),h(j),h(N);let e=A({date:y.startDate,time:y.startTime},y.timeZone),a=A({date:y.endDate,time:y.endTime},y.timeZone),i=L(e.date,e.time),n=L(a.date,a.time);t({startTime:i,endTime:n,quick:c(y),startTimeStamp:new Date(i).getTime(),endTimeStamp:new Date(n).getTime(),timeZone:y.timeZone})}()}}j.querySelector(".dt-time-box").appendChild(w),D.push({ele:w,component:s}),j.addEventListener("click",p),N.addEventListener("click",Y),function(t){t.classList.add("dt-show")}(j)})}async function $(t){return Z({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 l=new Date(a||Date.now());l.setFullYear(l.getFullYear()-20*!a);let r=new Date(i||Date.now()),M=new Date(n||Date.now()),m=new Date(i||Date.now()),c=new Date(n||Date.now());r.getUTCFullYear()===M.getUTCFullYear()&&m.getMonth()==M.getMonth()&&c.setMonth(M.getMonth()+1);let u=0;return u=void 0!==t.timeZone?t.timeZone:-new Date().getTimezoneOffset()/60,void 0===t.enableZone&&(t.enableZone=!0),t.lang=t.lang||"enUS",t.lang=t.lang.replace(/\-/,""),o[t.lang]||(t.lang="enUS"),{startDate:i?x(r):x(),endDate:n?x(M):x(),startTime:i?O(r):O(),endTime:n?O(M):O(),startDateShow:x(m),endDateShow:x(c),moveDate:x(),maxDate:x(l),maxTime:O(l),minDate:x(s),minTime:O(s),lang:t.lang||"enUS",timeZone:u,granularity:t.granularity||N.day,enableZone:t.enableZone}}(t))}function F(t,e,a){let i=w();void 0===a&&(a=i);let n=new Date(Y(t,i,a)),d=new Date(Y(e,i,a)),s={hour:d.getHours(),minute:d.getMinutes(),second:d.getSeconds(),millisecond:d.getMilliseconds()},o={hour:n.getHours(),minute:n.getMinutes(),second:n.getSeconds(),millisecond:n.getMilliseconds()},l={year:n.getFullYear(),month:n.getMonth()+1,date:n.getDate()},r={year:d.getFullYear(),month:d.getMonth()+1,date:d.getDate()},M=u();for(let t in M){var m,c,D,g,T,y,j,N,h,z,v,I,L,x;if(M[t]&&(null===(m=M[t])||void 0===m?void 0:m.endTime.hour)===s.hour&&(null===(c=M[t])||void 0===c?void 0:c.endTime.minute)===s.minute&&(null===(D=M[t])||void 0===D?void 0:D.endTime.second)===s.second&&(null===(g=M[t])||void 0===g?void 0:g.endTime.millisecond)===s.millisecond&&(null===(T=M[t])||void 0===T?void 0:T.startTime.hour)===o.hour&&(null===(y=M[t])||void 0===y?void 0:y.startTime.minute)===o.minute&&(null===(j=M[t])||void 0===j?void 0:j.startTime.second)===o.second&&(null===(N=M[t])||void 0===N?void 0:N.startTime.millisecond)===o.millisecond&&(null===(h=M[t])||void 0===h?void 0:h.startDate.year)===l.year&&(null===(z=M[t])||void 0===z?void 0:z.startDate.month)===l.month&&(null===(v=M[t])||void 0===v?void 0:v.startDate.date)===l.date&&(null===(I=M[t])||void 0===I?void 0:I.endDate.year)===r.year&&(null===(L=M[t])||void 0===L?void 0:L.endDate.month)===r.month&&(null===(x=M[t])||void 0===x?void 0:x.endDate.date)===r.date)return t}return null}function q(t,e){let a={startTime:"0000-00-
|
|
145
|
+
`),i.appendChild(j);let N=document.createElement("div");if(N.classList.add("dt-mask"),document.body.appendChild(N),window.innerWidth>768){let t=i.getBoundingClientRect();j.style.top=`${t.height+5}px`}let z=r(y);j.insertBefore(z,j.querySelector(".dt-content")),D.push({ele:z,component:e});let v=g(y,"start");j.querySelector(".dt-start").appendChild(v),D.push({ele:v,component:n});let I=k(y,"start");j.querySelector(".dt-start").appendChild(I),D.push({ele:I,component:d});let x=g(y,"end");j.querySelector(".dt-end").appendChild(x),D.push({ele:x,component:n});let O=k(y,"end");j.querySelector(".dt-end").appendChild(O),D.push({ele:O,component:d});let w=b(y);function S(){N.removeEventListener("click",Y),j.removeEventListener("click",p)}function Y(){S(),h(j),h(N),l("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(),h(j),h(N);let e=A({date:y.startDate,time:y.startTime},y.timeZone),a=A({date:y.endDate,time:y.endTime},y.timeZone),i=L(e.date,e.time),n=L(a.date,a.time);t({startTime:i,endTime:n,quick:c(y),startTimeStamp:new Date(i).getTime(),endTimeStamp:new Date(n).getTime(),timeZone:y.timeZone})}()}}j.querySelector(".dt-time-box").appendChild(w),D.push({ele:w,component:s}),j.addEventListener("click",p),N.addEventListener("click",Y),function(t){t.classList.add("dt-show")}(j)})}async function $(t){return Z({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 l=new Date(a||Date.now());l.setFullYear(l.getFullYear()-20*!a);let r=new Date(i||Date.now()),M=new Date(n||Date.now()),m=new Date(i||Date.now()),c=new Date(n||Date.now());r.getUTCFullYear()===M.getUTCFullYear()&&m.getMonth()==M.getMonth()&&c.setMonth(M.getMonth()+1);let u=0;return u=void 0!==t.timeZone?t.timeZone:-new Date().getTimezoneOffset()/60,void 0===t.enableZone&&(t.enableZone=!0),t.lang=t.lang||"enUS",t.lang=t.lang.replace(/\-/,""),o[t.lang]||(t.lang="enUS"),{startDate:i?x(r):x(),endDate:n?x(M):x(),startTime:i?O(r):O(),endTime:n?O(M):O(),startDateShow:x(m),endDateShow:x(c),moveDate:x(),maxDate:x(l),maxTime:O(l),minDate:x(s),minTime:O(s),lang:t.lang||"enUS",timeZone:u,granularity:t.granularity||N.day,enableZone:t.enableZone}}(t))}function F(t,e,a){let i=w();void 0===a&&(a=i);let n=new Date(Y(t,i,a)),d=new Date(Y(e,i,a)),s={hour:d.getHours(),minute:d.getMinutes(),second:d.getSeconds(),millisecond:d.getMilliseconds()},o={hour:n.getHours(),minute:n.getMinutes(),second:n.getSeconds(),millisecond:n.getMilliseconds()},l={year:n.getFullYear(),month:n.getMonth()+1,date:n.getDate()},r={year:d.getFullYear(),month:d.getMonth()+1,date:d.getDate()},M=u();for(let t in M){var m,c,D,g,T,y,j,N,h,z,v,I,L,x;if(M[t]&&(null===(m=M[t])||void 0===m?void 0:m.endTime.hour)===s.hour&&(null===(c=M[t])||void 0===c?void 0:c.endTime.minute)===s.minute&&(null===(D=M[t])||void 0===D?void 0:D.endTime.second)===s.second&&(null===(g=M[t])||void 0===g?void 0:g.endTime.millisecond)===s.millisecond&&(null===(T=M[t])||void 0===T?void 0:T.startTime.hour)===o.hour&&(null===(y=M[t])||void 0===y?void 0:y.startTime.minute)===o.minute&&(null===(j=M[t])||void 0===j?void 0:j.startTime.second)===o.second&&(null===(N=M[t])||void 0===N?void 0:N.startTime.millisecond)===o.millisecond&&(null===(h=M[t])||void 0===h?void 0:h.startDate.year)===l.year&&(null===(z=M[t])||void 0===z?void 0:z.startDate.month)===l.month&&(null===(v=M[t])||void 0===v?void 0:v.startDate.date)===l.date&&(null===(I=M[t])||void 0===I?void 0:I.endDate.year)===r.year&&(null===(L=M[t])||void 0===L?void 0:L.endDate.month)===r.month&&(null===(x=M[t])||void 0===x?void 0:x.endDate.date)===r.date)return t}return null}function q(t,e){let a={startTime:"0000-00-00T00:00:00.000",endTime:"0000-00-00T00:00:00.000",startTimeStamp:0,endTimeStamp:0},i=u();if(!i[t])return a;void 0===e&&(e=w());let n=A({date:i[t].startDate,time:i[t].startTime},e),d=A({date:i[t].endDate,time:i[t].endTime},e);return a.startTime=L(n.date,n.time),a.endTime=L(d.date,d.time),a.startTimeStamp=new Date(a.startTime).getTime(),a.endTimeStamp=new Date(a.endTime).getTime(),a}a(406),a(276);let P={open:$,getLimitKeyByTimetamp:F,getTimestampByLimitKey:q,getTimeStringByTimestamp:function(t){let e=new Date(t);return`${z(e.getFullYear(),e.getMonth()+1,e.getDate())} ${v(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}`},getTimeStringByTimeZone:Y,i18n:o}})();var n=i.ZP,d=i.sM,s=i.rC,o=i.ag,l=i.bA;export{n as default,d as getLimitKeyByTimetamp,s as getTimestampByLimitKey,o as i18n,l as open};
|
package/package.json
CHANGED
package/type.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface kitComponent {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export type status = 'start' | 'end';
|
|
72
|
-
export type timeString = `${number}-${number}-${number}
|
|
72
|
+
export type timeString = `${number}-${number}-${number}T${number}:${number}:${number}.${number}`;
|
|
73
73
|
export type Lang = 'zhCN' | 'enUS';
|
|
74
74
|
export interface kitOption {
|
|
75
75
|
root: HTMLElement,
|