PageSourceSearch

https://conversiontab.com/build/assets/date-time-tools-page-sf0Fs6BF.js

js conversiontab.com collected 2026-10-01 12:32:06 UTC 22,030 bytes, 11 lines download raw bytes

vendor: 4,629 bytes, line 1
1import{g as tt,c as et}from"./_commonjsHelpers-BosuxZz1.js";var rt={exports:{}};(function(c,v){(function(f,$){c.exports=$()})(et,function(){var f=1e3,$=6e4,z=36e5,T="millisecond",d="second",b="minute",g="hour",C="day",B="week",k="month",p="quarter",m="year",h="date",s="Invalid Date",D=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,N=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,O={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(l){var o=["th","st","nd","rd"],e=l%100;return"["+l+(o[(e-20)%10]||o[e]||o[0])+"]"}},E=function(l,o,e){var i=String(l);return!i||i.length>=o?l:""+Array(o+1-i.length).join(e)+l},U={s:E,z:function(l){var o=-l.utcOffset(),e=Math.abs(o),i=Math.floor(e/60),r=e%60;return(o<=0?"+":"-")+E(i,2,"0")+":"+E(r,2,"0")},m:function l(o,e){if(o.date()<e.date())return-l(e,o);var i=12*(e.year()-o.year())+(e.month()-o.month()),r=o.clone().add(i,k),t=e-r<0,n=o.clone().add(i+(t?-1:1),k);return+(-(i+(e-r)/(t?r-n:n-r))||0)},a:function(l){return l<0?Math.ceil(l)||0:Math.floor(l)},p:function(l){return{M:k,y:m,w:B,d:C,D:h,h:g,m:b,s:d,ms:T,Q:p}[l]||String(l||"").toLowerCase().replace(/s$/,"")},u:function(l){return l===void 0}},L="en",I={};I[L]=O;var Y="$isDayjsObject",w=function(l){return l instanceof J||!(!l||!l[Y])},H=function l(o,e,i){var r;if(!o)return L;if(typeof o=="string"){var t=o.toLowerCase();I[t]&&(r=t),e&&(I[t]=e,r=t);var n=o.split("-");if(!r&&n.length>1)return l(n[0])}else{var u=o.name;I[u]=o,r=u}return!i&&r&&(L=r),r||!i&&L},y=function(l,o){if(w(l))return l.clone();var e=typeof o=="object"?o:{};return e.date=l,e.args=arguments,new J(e)},a=U;a.l=H,a.i=w,a.w=function(l,o){return y(l,{locale:o.$L,utc:o.$u,x:o.$x,$offset:o.$offset})};var J=function(){function l(e){this.$L=H(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[Y]=!0}var o=l.prototype;return o.parse=function(e){this.$d=function(i){var r=i.date,t=i.utc;if(r===null)return new Date(NaN);if(a.u(r))return new Date;if(r instanceof Date)return new Date(r);if(typeof r=="string"&&!/Z$/i.test(r)){var n=r.match(D);if(n){var u=n[2]-1||0,M=(n[7]||"0").substring(0,3);return t?new Date(Date.UTC(n[1],u,n[3]||1,n[4]||0,n[5]||0,n[6]||0,M)):new Date(n[1],u,n[3]||1,n[4]||0,n[5]||0,n[6]||0,M)}}return new Date(r)}(e),this.init()},o.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},o.$utils=function(){return a},o.isValid=function(){return this.$d.toString()!==s},o.isSame=function(e,i){var r=y(e);return this.startOf(i)<=r&&r<=this.endOf(i)},o.isAfter=function(e,i){return y(e)<this.startOf(i)},o.isBefore=function(e,i){return this.endOf(i)<y(e)},o.$g=function(e,i,r){return a.u(e)?this[i]:this.set(r,e)},o.unix=function(){return Math.floor(this.valueOf()/1e3)},o.valueOf=function(){return this.$d.getTime()},o.startOf=function(e,i){var r=this,t=!!a.u(i)||i,n=a.p(e),u=function(P,R){var W=a.w(r.$u?Date.UTC(r.$y,R,P):new Date(r.$y,R,P),r);return t?W:W.endOf(C)},M=function(P,R){return a.w(r.toDate()[P].apply(r.toDate("s"),(t?[0,0,0,0]:[23,59,59,999]).slice(R)),r)},S=this.$W,x=this.$M,F=this.$D,j="set"+(this.$u?"UTC":"");switch(n){case m:return t?u(1,0):u(31,11);case k:return t?u(1,x):u(0,x+1);case B:var _=this.$locale().weekStart||0,A=(S<_?S+7:S)-_;return u(t?F-A:F+(6-A),x);case C:case h:return M(j+"Hours",0);case g:return M(j+"Minutes",1);case b:return M(j+"Seconds",2);case d:return M(j+"Milliseconds",3);default:return this.clone()}},o.endOf=function(e){return this.startOf(e,!1)},o.$set=function(e,i){var r,t=a.p(e),n="set"+(this.$u?"UTC":""),u=(r={},r[C]=n+"Date",r[h]=n+"Date",r[k]=n+"Month",r[m]=n+"FullYear",r[g]=n+"Hours",r[b]=n+"Minutes",r[d]=n+"Seconds",r[T]=n+"Milliseconds",r)[t],M=t===C?this.$D+(i-this.$W):i;if(t===k||t===m){var S=this.clone().set(h,1);S.$d[u](M),S.init(),this.$d=S.set(h,Math.min(this.$D,S.daysInMonth())).$d}else u&&this.$d[u](M);return this.init(),this},o.set=function(e,i){return this.clone().$set(e,i)},o.get=function(e){return this[a.p(e)]()},o.add=function(e,i){var r,t=this;e=Number(e);var n=a.p(i),u=function(x){var F=y(t);return a.w(F.date(F.date()+Math.round(x*e)),t)};if(n===k)return this.set(k,this.$M+e);if(n===m)return this.set(m,this.$y+e);if(n===C)return u(1);if(n===B)return u(7);var M=(r={},r[b]=$,r[g]=z,r[d]=f,r)[n]||1,S=this.$d.getTime()+e*M;return a.w(S,this)}
vendor: 5,442 bytes, line 1
1,o.subtract=function(e,i){return this.add(-1*e,i)},o.format=function(e){var i=this,r=this.$locale();if(!this.isValid())return r.invalidDate||s;var t=e||"YYYY-MM-DDTHH:mm:ssZ",n=a.z(this),u=this.$H,M=this.$m,S=this.$M,x=r.weekdays,F=r.months,j=r.meridiem,_=function(R,W,G,X){return R&&(R[W]||R(i,t))||G[W].slice(0,X)},A=function(R){return a.s(u%12||12,R,"0")},P=j||function(R,W,G){var X=R<12?"AM":"PM";return G?X.toLowerCase():X};return t.replace(N,function(R,W){return W||function(G){switch(G){case"YY":return String(i.$y).slice(-2);case"YYYY":return a.s(i.$y,4,"0");case"M":return S+1;case"MM":return a.s(S+1,2,"0");case"MMM":return _(r.monthsShort,S,F,3);case"MMMM":return _(F,S);case"D":return i.$D;case"DD":return a.s(i.$D,2,"0");case"d":return String(i.$W);case"dd":return _(r.weekdaysMin,i.$W,x,2);case"ddd":return _(r.weekdaysShort,i.$W,x,3);case"dddd":return x[i.$W];case"H":return String(u);case"HH":return a.s(u,2,"0");case"h":return A(1);case"hh":return A(2);case"a":return P(u,M,!0);case"A":return P(u,M,!1);case"m":return String(M);case"mm":return a.s(M,2,"0");case"s":return String(i.$s);case"ss":return a.s(i.$s,2,"0");case"SSS":return a.s(i.$ms,3,"0");case"Z":return n}return null}(R)||n.replace(":","")})},o.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},o.diff=function(e,i,r){var t,n=this,u=a.p(i),M=y(e),S=(M.utcOffset()-this.utcOffset())*$,x=this-M,F=function(){return a.m(n,M)};switch(u){case m:t=F()/12;break;case k:t=F();break;case p:t=F()/3;break;case B:t=(x-S)/6048e5;break;case C:t=(x-S)/864e5;break;case g:t=x/z;break;case b:t=x/$;break;case d:t=x/f;break;default:t=x}return r?t:a.a(t)},o.daysInMonth=function(){return this.endOf(k).$D},o.$locale=function(){return I[this.$L]},o.locale=function(e,i){if(!e)return this.$L;var r=this.clone(),t=H(e,i,!0);return t&&(r.$L=t),r},o.clone=function(){return a.w(this.$d,this)},o.toDate=function(){return new Date(this.valueOf())},o.toJSON=function(){return this.isValid()?this.toISOString():null},o.toISOString=function(){return this.$d.toISOString()},o.toString=function(){return this.$d.toUTCString()},l}(),Q=J.prototype;return y.prototype=Q,[["$ms",T],["$s",d],["$m",b],["$H",g],["$W",C],["$M",k],["$y",m],["$D",h]].forEach(function(l){Q[l[1]]=function(o){return this.$g(o,l[0],l[1])}}),y.extend=function(l,o){return l.$i||(l(o,J,y),l.$i=!0),y},y.locale=H,y.isDayjs=w,y.unix=function(l){return y(1e3*l)},y.en=I[L],y.Ls=I,y.p={},y})})(rt);var it=rt.exports;const q=tt(it);var ot={exports:{}};(function(c,v){(function(f,$){c.exports=$()})(et,function(){var f="minute",$=/[+-]\d\d(?::?\d\d)?/g,z=/([+-]|\d\d)/g;return function(T,d,b){var g=d.prototype;b.utc=function(s){var D={date:s,utc:!0,args:arguments};return new d(D)},g.utc=function(s){var D=b(this.toDate(),{locale:this.$L,utc:!0});return s?D.add(this.utcOffset(),f):D},g.local=function(){return b(this.toDate(),{locale:this.$L,utc:!1})};var C=g.parse;g.parse=function(s){s.utc&&(this.$u=!0),this.$utils().u(s.$offset)||(this.$offset=s.$offset),C.call(this,s)};var B=g.init;g.init=function(){if(this.$u){var s=this.$d;this.$y=s.getUTCFullYear(),this.$M=s.getUTCMonth(),this.$D=s.getUTCDate(),this.$W=s.getUTCDay(),this.$H=s.getUTCHours(),this.$m=s.getUTCMinutes(),this.$s=s.getUTCSeconds(),this.$ms=s.getUTCMilliseconds()}else B.call(this)};var k=g.utcOffset;g.utcOffset=function(s,D){var N=this.$utils().u;if(N(s))return this.$u?0:N(this.$offset)?k.call(this):this.$offset;if(typeof s=="string"&&(s=function(L){L===void 0&&(L="");var I=L.match($);if(!I)return null;var Y=(""+I[0]).match(z)||["-",0,0],w=Y[0],H=60*+Y[1]+ +Y[2];return H===0?0:w==="+"?H:-H}(s),s===null))return this;var O=Math.abs(s)<=16?60*s:s;if(O===0)return this.utc(D);var E=this.clone();if(D)return E.$offset=O,E.$u=!1,E;var U=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(E=this.local().add(O+U,f)).$offset=O,E.$x.$localOffset=U,E};var p=g.format;g.format=function(s){var D=s||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return p.call(this,D)},g.valueOf=function(){var s=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*s},g.isUTC=function(){return!!this.$u},g.toISOString=function(){return this.toDate().toISOString()},g.toString=function(){return this.toDate().toUTCString()};var m=g.toDate;g.toDate=function(s){return s==="s"&&this.$offset?b(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():m.call(this)};var h=g.diff;g.diff=function(s,D,N){if(s&&this.$u===s.$u)return h.call(this,s,D,N);var O=this.local(),E=b(s).local();return h.call(O,E,D,N)}}})})(ot);var at=ot.exports;const ut=tt(at);var st={exports:{}};(function(c,v){(function(f,$){c.exports=$()})(et,function(){var f={year:0,month:1,day:2,hour:3,minute:4,second:5},$={};return function(z,T,d){var b,g=function(p,m,h){h===void 0&&(h={});var s=new Date(p),D=function(N,O){O===void 0&&(O={});var E=O.timeZoneName||"short",U=N+"|"+E,L=$[U];return L||(L=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:N,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:E}),$[U]=L),L}(m,h);return D.formatToParts(s)},C=function(p,m){for(var h=g(p,m),s=[],D=0;D<h.length;D+=1){var N=h[D],O=N.type,E=N.value,U=f[O];U>=0&&(s[U]=parseInt(E,10))}var L=s[3],I=L===24?0:L,Y=s[0]+"-"+s[1]+"-"+s[2]+" "+I+":"+s[4]+":"+s[5]+":000",w=+p;return(d.utc(Y).valueOf()-(w-=w%1e3))/6e4},B=T.prototype;B.tz=function(p,m){p===void 0&&(p=b);
1var h,s=this.utcOffset(),D=this.toDate(),N=D.toLocaleString("en-US",{timeZone:p}),O=Math.round((D-new Date(N))/1e3/60),E=15*-Math.round(D.getTimezoneOffset()/15)-O;if(!Number(E))h=this.utcOffset(0,m);else if(h=d(N,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(E,!0),m){var U=h.utcOffset();h=h.add(s-U,"minute")}return h.$x.$timezone=p,h},B.offsetName=function(p){var m=this.$x.$timezone||d.tz.guess(),h=g(this.valueOf(),m,{timeZoneName:p}).find(function(s){return s.type.toLowerCase()==="timezonename"});return h&&h.value};var k=B.startOf;B.startOf=function(p,m){if(!this.$x||!this.$x.$timezone)return k.call(this,p,m);var h=d(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return k.call(h,p,m).tz(this.$x.$timezone,!0)},d.tz=function(p,m,h){var s=h&&m,D=h||m||b,N=C(+d(),D);if(typeof p!="string")return d(p).tz(D);var O=function(I,Y,w){var H=I-60*Y*1e3,y=C(H,w);if(Y===y)return[H,Y];var a=C(H-=60*(y-Y)*1e3,w);return y===a?[H,y]:[I-60*Math.min(y,a)*1e3,Math.max(y,a)]}(d.utc(p,s).valueOf(),N,D),E=O[0],U=O[1],L=d(E).utcOffset(U);return L.$x.$timezone=D,L},d.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},d.tz.setDefault=function(p){b=p}}})})(st);var ct=st.exports;const lt=tt(ct);q.extend(ut);q.extend(lt);function V(c){const v=document.getElementById("ctDtToastBody"),f=document.getElementById("ctDtToast");if(!v||!f||typeof bootstrap>"u"){window.alert(c);return}v.textContent=c,bootstrap.Toast.getOrCreateInstance(f).show()}function Z(c,v=2){return String(c).padStart(v,"0")}function nt(c){return Z(c,4)}function dt(c){var $,z,T;if(!c)return;const v=typeof Intl<"u"&&typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("timeZone"):["UTC","Asia/Karachi","Europe/London","America/New_York"];c.innerHTML=v.map(d=>`<option value="${d}">${d}</option>`).join("");const f=((T=($=Intl==null?void 0:Intl.DateTimeFormat)==null?void 0:(z=$.call(Intl)).resolvedOptions)==null?void 0:T.call(z).timeZone)||"UTC";[...c.options].some(d=>d.value===f)?c.value=f:c.value="UTC"}function ft(c){const v=String(c||"").trim();if(!v||!/^-?\d+(\.\d+)?$/.test(v))return null;let f=Math.floor(Number(v));if(!Number.isFinite(f))return null;const $=String(Math.abs(f)).length;if($>=19){const d=Math.floor(f/1e6),b=Math.floor(d/1e3);return{ms:d,sec:b,unit:"ns"}}if($>=16){const d=Math.floor(f/1e3),b=Math.floor(d/1e3);return{ms:d,sec:b,unit:"us"}}if($>=13){const d=f,b=Math.floor(d/1e3);return{ms:d,sec:b,unit:"ms"}}const z=f;return{ms:z*1e3,sec:z,unit:"s"}}function mt(){const c=document.getElementById("ctDtNowEpoch");if(!c)return()=>{};const v=()=>{c.textContent=String(Math.floor(Date.now()/1e3))};v();const f=setInterval(v,1e3);return()=>clearInterval(f)}function ht(){const c=document.querySelector('input[name="ctDtRangeMode"]:checked'),v=c==null?void 0:c.value;return v==="year"||v==="month"||v==="day"?v:"month"}function vt(c){var l,o,e,i,r;const v=document.getElementById("ctDtZone");dt(v);const f=mt(),$=()=>(v==null?void 0:v.value)||"UTC",z=document.getElementById("ctDtEpochIn"),T=document.getElementById("ctDtHumanY"),d=document.getElementById("ctDtHumanMo"),b=document.getElementById("ctDtHumanD"),g=document.getElementById("ctDtHumanHh"),C=document.getElementById("ctDtHumanMi"),B=document.getElementById("ctDtHumanS"),k=()=>{const t=$(),n=q().tz(t);T&&(T.value=String(n.year())),d&&(d.value=String(n.month()+1)),b&&(b.value=String(n.date())),g&&(g.value=String(n.hour())),C&&(C.value=String(n.minute())),B&&(B.value=String(n.second()))},p=document.getElementById("ctDtRangeY"),m=document.getElementById("ctDtRangeMo"),h=document.getElementById("ctDtRangeD"),s=()=>{const t=$(),n=q().tz(t);p&&(p.value=String(n.year())),m&&(m.value=String(n.month()+1)),h&&(h.value=String(n.date()))};c==="epoch-converter"&&(z&&(z.value=String(Math.floor(Date.now()/1e3))),k()),(c==="epoch-converter"||c==="time-ranges")&&s(),v==null||v.addEventListener("change",()=>{if(c==="epoch-converter"){const t=T==null?void 0:T.value;t!==void 0&&t!==""&&Number.isFinite(Number(t))||k()}s()});const D=document.getElementById("ctDtEpochResultSec"),N=document.getElementById("ctDtEpochResultMs"),O=document.getElementById("ctDtHumanUtc"),E=document.getElementById("ctDtHumanLocal");(l=document.getElementById("ctDtEpochToHuman"))==null||l.addEventListener("click",()=>{const t=ft((z==null?void 0:z.value)||"");if(!t){V("Invalid epoch timestamp. Use seconds/ms/us/ns digits only.");return}const n=$(),u=q(t.ms).tz(n),M=q(t.ms).utc();
1T&&(T.value=String(u.year())),d&&(d.value=String(u.month()+1)),b&&(b.value=String(u.date())),g&&(g.value=String(u.hour())),C&&(C.value=String(u.minute())),B&&(B.value=String(u.second())),D&&(D.textContent=String(t.sec)),N&&(N.textContent=String(t.ms)),O&&(O.textContent=M.format("dddd, DD MMMM YYYY HH:mm:ss [UTC]")),E&&(E.textContent=u.format("dddd, DD MMMM YYYY HH:mm:ss z"))}),(o=document.getElementById("ctDtHumanToEpoch"))==null||o.addEventListener("click",()=>{const t=Number(T==null?void 0:T.value),n=Number(d==null?void 0:d.value),u=Number(b==null?void 0:b.value),M=Number(g==null?void 0:g.value),S=Number(C==null?void 0:C.value),x=Number(B==null?void 0:B.value);if(!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(u)||!Number.isFinite(M)||!Number.isFinite(S)||!Number.isFinite(x)){V("Invalid human date fields.");return}const F=$(),j=q.tz(`${nt(t)}-${Z(n)}-${Z(u)} ${Z(M)}:${Z(S)}:${Z(x)}`,"YYYY-MM-DD HH:mm:ss",F);if(!j.isValid()){V("Invalid human date for the selected timezone.");return}const _=j.valueOf(),A=Math.floor(_/1e3);z&&(z.value=String(A)),D&&(D.textContent=String(A)),N&&(N.textContent=String(_)),O&&(O.textContent=j.utc().format("dddd, DD MMMM YYYY HH:mm:ss [UTC]")),E&&(E.textContent=j.format("dddd, DD MMMM YYYY HH:mm:ss z"))}),(e=document.getElementById("ctDtRangeConvert"))==null||e.addEventListener("click",()=>{const t=Number(p==null?void 0:p.value),n=Number(m==null?void 0:m.value),u=Number(h==null?void 0:h.value);if(!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(u)){V("Invalid range date fields.");return}const M=$(),S=q.tz(`${nt(t)}-${Z(n)}-${Z(u)} 00:00:00`,"YYYY-MM-DD HH:mm:ss",M);if(!S.isValid()){V("Invalid range date for the selected timezone.");return}const x=ht(),F=S.startOf(x),j=S.endOf(x),_=document.getElementById("ctDtRangeStartSec"),A=document.getElementById("ctDtRangeEndSec"),P=document.getElementById("ctDtRangeStartText"),R=document.getElementById("ctDtRangeEndText");_&&(_.textContent=String(Math.floor(F.valueOf()/1e3))),A&&(A.textContent=String(Math.floor(j.valueOf()/1e3))),P&&(P.textContent=F.format("dddd, DD MMMM YYYY HH:mm:ss z")),R&&(R.textContent=j.format("dddd, DD MMMM YYYY HH:mm:ss z"))});const U=document.getElementById("ctDtSecondsIn"),L=document.getElementById("ctDtDhmsDays"),I=document.getElementById("ctDtDhmsHours"),Y=document.getElementById("ctDtDhmsMinutes"),w=document.getElementById("ctDtDhmsSecs"),H=document.getElementById("ctDtDhmsOut"),y=document.getElementById("ctDtDhmsTotalLine");function a(t,n,u,M,S){H&&(H.textContent=`${n} days, ${u} hours, ${M} minutes, ${S} seconds`),y&&(y.textContent=`Total: ${t} seconds`)}function J(){let t=Number(U==null?void 0:U.value);if(!Number.isFinite(t)||t<0){V("Invalid total seconds. Use a non-negative number.");return}t=Math.floor(t);let n=t;const u=Math.floor(n/86400);n-=u*86400;const M=Math.floor(n/3600);n-=M*3600;const S=Math.floor(n/60),x=n-S*60;L&&(L.value=String(u)),I&&(I.value=String(M)),Y&&(Y.value=String(S)),w&&(w.value=String(x)),a(t,u,M,S,x)}function Q(){const t=(F,j)=>{const _=F==null?void 0:F.value;if(_===""||_==null)return 0;const A=Number(_);return!Number.isFinite(A)||A<0?(V(`Invalid ${j}. Use a non-negative number.`),null):Math.floor(A)},n=t(L,"days");if(n===null)return;const u=t(I,"hours");if(u===null)return;const M=t(Y,"minutes");if(M===null)return;const S=t(w,"seconds");if(S===null)return;const x=n*86400+u*3600+M*60+S;if(!Number.isFinite(x)||x<0){V("Combined value is too large or invalid.");return}U&&(U.value=String(x)),a(x,n,u,M,S)}(i=document.getElementById("ctDtSecondsToParts"))==null||i.addEventListener("click",J),(r=document.getElementById("ctDtPartsToSeconds"))==null||r.addEventListener("click",Q),U&&H&&J(),window.addEventListener("beforeunload",()=>{f()},{once:!0})}function K(c){if(c==null||Number.isNaN(c))return"—";const v=Math.floor(c/36e5),f=Math.floor(c%36e5/6e4),$=Math.floor(c%6e4/1e3),z=Math.floor(c%1e3);return`${Z(v)}:${Z(f)}:${Z($)}.${String(z).padStart(3,"0")}`}function gt(){var c;return(c=globalThis.crypto)!=null&&c.randomUUID?globalThis.crypto.randomUUID():`r-${Date.now()}-${Math.random().toString(16).slice(2)}`}function $t(){const c=document.getElementById("ctDtSwDisplay"),v=d
1ocument.querySelector("#ctDtSwTable tbody"),f=document.getElementById("ctDtSwStartPause"),$=document.getElementById("ctDtSwSplit"),z=document.getElementById("ctDtSwReset"),T=document.getElementById("ctDtSwReverse"),d=document.getElementById("ctDtSwExportRow"),b=document.getElementById("ctDtSwExportCsv"),g=document.getElementById("ctDtSwExportTxt");let C=0,B=!1,k=0,p=0,m=[];function h(){p&&cancelAnimationFrame(p),p=0}function s(){return C+(B?performance.now()-k:0)}function D(){c&&(c.textContent=K(s()))}function N(){D(),p=requestAnimationFrame(N)}function O(){d&&d.classList.toggle("d-none",m.length===0)}function E(){var Y;if(!v)return;v.innerHTML="";const I=T!=null&&T.checked?[...m].reverse():m;for(const w of I){const H=document.createElement("tr");H.dataset.id=w.id,H.innerHTML=`
2                <td>${w.index}</td>
3                <td><input type="text" class="form-control form-control-sm ct-dt-sw-label" value="" /></td>
4                <td class="font-monospace">${K(w.intervalMs)}</td>
5                <td class="font-monospace">${K(w.totalMs)}</td>
6                <td class="small">${w.recordedAt.toLocaleString()}</td>
7                <td class="text-end"><button type="button" class="btn btn-sm btn-outline-danger ct-dt-sw-del">Delete</button></td>
8            `;const y=H.querySelector(".ct-dt-sw-label");y&&(y.value=w.label,y.addEventListener("input",()=>{w.label=y.value})),(Y=H.querySelector(".ct-dt-sw-del"))==null||Y.addEventListener("click",()=>{m=m.filter(a=>a.id!==w.id),E(),O()}),v.appendChild(H)}}function U(I,Y=null,w=null){m.push({id:gt(),index:m.length+1,label:I,intervalMs:Y,totalMs:w,recordedAt:new Date}),E(),O()}f==null||f.addEventListener("click",()=>{B?(C=s(),B=!1,h(),f&&(f.textContent="Start",f.classList.add("btn-primary"),f.classList.remove("btn-warning")),U("Pause"),D()):(B=!0,k=performance.now(),f&&(f.textContent="Pause",f.classList.remove("btn-primary"),f.classList.add("btn-warning")),$==null||$.removeAttribute("disabled"),U("Start"),p=requestAnimationFrame(N))}),$==null||$.addEventListener("click",()=>{var w;if(!B)return;const I=s(),Y=((w=m.filter(H=>H.totalMs!=null).slice(-1)[0])==null?void 0:w.totalMs)||0;U("Split",I-Y,I)}),z==null||z.addEventListener("click",()=>{h(),C=0,B=!1,m=[],f&&(f.textContent="Start",f.classList.add("btn-primary"),f.classList.remove("btn-warning")),$==null||$.setAttribute("disabled",""),v&&(v.innerHTML=""),O(),D()}),T==null||T.addEventListener("change",()=>{E()});function L(I){if(!m.length)return;const Y=m.map(a=>({"#":a.index,Label:a.label,Interval:K(a.intervalMs),Total:K(a.totalMs),Time:a.recordedAt.toLocaleString()}));let w="";I==="csv"?w=Object.keys(Y[0]).join(",")+`
9`+Y.map(a=>Object.values(a).join(",")).join(`
10`):w=Y.map(a=>`${a["#"]}. ${a.Label} | ${a.Interval} | ${a.Total} | ${a.Time}`).join(`
11`);const H=new Blob([w],{type:"text/plain;charset=utf-8"}),y=document.createElement("a");y.href=URL.createObjectURL(H),y.download=I==="csv"?"stopwatch.csv":"stopwatch.txt",y.click(),URL.revokeObjectURL(y.href)}b==null||b.addEventListener("click",()=>L("csv")),g==null||g.addEventListener("click",()=>L("txt")),D()}function yt(){const c=document.getElementById("ct-date-time-tools-root");if(!c)return;const v=(c.dataset.ctPage||"epoch-converter").toLowerCase();v==="stopwatch"?$t():vt(v)}export{yt as initDateTimeToolsPage};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.