PageSourceSearch

https://yuhi-sa.github.io/devtoolbox/_next/static/chunks/1761.3eacdb6634dfac1f.js

js yuhi-sa.github.io collected 2026-10-03 10:14:09 UTC 5,501 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1761],{1761:(e,t,a)=>{a.r(t),a.d(t,{default:()=>l});var r=a(4568),s=a(7620),d=a(6972);function l(){let e=new Date().toISOString().split("T")[0],[t,a]=(0,s.useState)(e),[l,n]=(0,s.useState)(e),[o,c]=(0,s.useState)(null),[i,g]=(0,s.useState)(""),[u,m]=(0,s.useState)(e),[x,y]=(0,s.useState)("0"),[b,h]=(0,s.useState)(""),[f,p]=(0,s.useState)(""),k=o?"".concat(o.years,"y ").concat(o.months,"m ").concat(o.days,"d (").concat(o.totalDays," days, ").concat(o.totalWeeks," weeks)"):"";return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-gray-800 dark:text-gray-200",children:"Date Difference"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Start Date"}),(0,r.jsx)("input",{type:"date",value:t,onChange:e=>a(e.target.value),className:"w-full p-2 border rounded bg-white dark:bg-gray-800 dark:border-gray-600 focus:ring-2 focus:ring-blue-500 focus:outline-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"End Date"}),(0,r.jsx)("input",{type:"date",value:l,onChange:e=>n(e.target.value),className:"w-full p-2 border rounded bg-white dark:bg-gray-800 dark:border-gray-600 focus:ring-2 focus:ring-blue-500 focus:outline-none"})]})]}),(0,r.jsx)("button",{onClick:()=>{try{g(""),c(function(e,t){let a=new Date(e),r=new Date(t);if(isNaN(a.getTime())||isNaN(r.getTime()))throw Error("Invalid date format");let s=a<r?a:r,d=a<r?r:a,l=Math.floor((d.getTime()-s.getTime())/864e5),n=Math.floor(l/7),o=d.getFullYear()-s.getFullYear(),c=d.getMonth()-s.getMonth(),i=d.getDate()-s.getDate();return i<0&&(c--,i+=new Date(d.getFullYear(),d.getMonth(),0).getDate()),c<0&&(o--,c+=12),{totalDays:l,totalWeeks:n,years:o,months:c,days:i}}(t,l))}catch(e){g(e.message),c(null)}},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition",children:"Calculate Difference"}),i&&(0,r.jsx)("div",{className:"text-red-500 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded",children:i}),o&&(0,r.jsx)("div",{className:"p-4 border rounded-lg bg-white dark:bg-gray-800 dark:border-gray-600",children:(0,r.jsxs)("div",{className:"flex justify-between items-start",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:[o.years>0&&"".concat(o.years," year").concat(1!==o.years?"s":""," "),o.months>0&&"".concat(o.months," month").concat(1!==o.months?"s":""," "),o.days," day",1!==o.days?"s":""]}),(0,r.jsxs)("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:[o.totalDays," total days / ",o.totalWeeks," weeks"]})]}),(0,r.jsx)(d.A,{text:k})]})})]}),(0,r.jsx)("hr",{className:"dark:border-gray-600"}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-gray-800 dark:text-gray-200",children:"Add/Subtract Days"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Base Date"}),(0,r.jsx)("input",{type:"date",value:u,onChange:e=>m(e.target.value),className:"w-full p-2 border rounded bg-white dark:bg-gray-800 dark:border-gray-600 focus:ring-2 focus:ring-blue-500 focus:outline-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium mb-1 text-gray-700 dark:text-gray-300",children:"Days (negative to subtract)"}),(0,r.jsx)("input",{type:"number",value:x,onChange:e=>y(e.target.value),className:"w-full p-2 border rounded bg-white dark:bg-gray-800 dark:border-gray-600 focus:ring-2 focus:ring-blue-500 focus:outline-none"})]})]}),(0,r.jsx)("button",{onClick:()=>{try{p(""),h(function(e,t){let a=new Date(e);if(isNaN(a.getTime()))throw Error("Invalid date format");return a.setDate(a.getDate()+t),a.toISOString().split("T")[0]}(u,parseInt(x,10)||0))}catch(e){p(e.message),h("")}},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition",children:"Calculate"}),f&&(0,r.jsx)("div",{className:"text-red-500 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded",children:f}),b&&(0,r.jsx)("div",{className:"p-4 border rounded-lg bg-white dark:bg-gray-800 dark:border-gray-600",children:(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsx)("div",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:b}),(0,r.jsx)(d.A,{text:b})]})})]})]})}},6972:(e,t,a)=>{a.d(t,{A:()=>l});var r=a(4568),s=a(7620);async function d(e){try{return await navigator.clipboard.writeText(e),!0}catch(a){let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{return document.execCommand("copy"),!0}catch(e){return!1}finally{document.body.removeChild(t)}}}function l(e){let{text:t,label:a="Copy"}
1=e,[l,n]=(0,s.useState)(!1),o=async()=>{await d(t)&&(n(!0),setTimeout(()=>n(!1),2e3))};return(0,r.jsx)("button",{onClick:o,disabled:!t,className:"px-3 py-1 text-sm border rounded hover:bg-gray-100 dark:hover:bg-gray-700 dark:border-gray-600 transition disabled:opacity-50",children:l?"Copied!":a})}}}]);

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.