<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kang Jeongsik</title>
    <description>The latest articles on DEV Community by Kang Jeongsik (@vintage97).</description>
    <link>https://dev.to/vintage97</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3941457%2Fe484fd93-9132-442c-90e2-2dc5686225df.png</url>
      <title>DEV Community: Kang Jeongsik</title>
      <link>https://dev.to/vintage97</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vintage97"/>
    <language>en</language>
    <item>
      <title>The US federal holiday for 2028 New Year's Day falls in 2027</title>
      <dc:creator>Kang Jeongsik</dc:creator>
      <pubDate>Tue, 17 Nov 2026 03:56:58 +0000</pubDate>
      <link>https://dev.to/vintage97/the-us-federal-holiday-for-2028-new-years-day-falls-in-2027-59il</link>
      <guid>https://dev.to/vintage97/the-us-federal-holiday-for-2028-new-years-day-falls-in-2027-59il</guid>
      <description>&lt;p&gt;January 1, 2028 is a Saturday. Under the US federal rule, a holiday that lands on a Saturday is observed on the Friday before. So the day off for New Year's 2028 is Friday, December 31, 2027.&lt;/p&gt;

&lt;p&gt;That one date broke an assumption in my business-days code: "this year's holidays happen in this year."&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it shows up
&lt;/h2&gt;

&lt;p&gt;OPM publishes holiday schedules by year. Its 2028 table starts with "Friday, December 31 * New Year's Day", and that Friday falls in 2027. If you build a holiday list by looping over one year's rules and keeping dates inside that year, you drop it.&lt;/p&gt;

&lt;p&gt;The result is off by one. My calculator counts 249 US federal business days in 2027. That year has 12 weekday federal holidays, not the usual 11. It gets two New Year's days: Friday, January 1, 2027 for its own, and Friday, December 31, 2027 for 2028's.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix
&lt;/h2&gt;

&lt;p&gt;When I generate holidays for year Y, I also check January 1 of year Y+1:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// if next year's Jan 1 is a Saturday, its observed day is Dec 31 of this year&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;nextNY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;UTC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;year&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nextNY&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUTCDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"New Year's Day (observed)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;UTC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;31&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// and drop this year's Jan 1 holiday if it was moved back into last year&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUTCFullYear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The filter matters too. In 2022, January 1 was also a Saturday, so the observed day was December 31, 2021. It belongs in 2021's count, not 2022's.&lt;/p&gt;

&lt;h2&gt;
  
  
  The UK does it the other way
&lt;/h2&gt;

&lt;p&gt;England and Wales move a weekend bank holiday forward, to the next weekday. In late 2027 that gives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Christmas Day (Saturday) is observed Monday, December 27&lt;/li&gt;
&lt;li&gt;Boxing Day (Sunday) is observed Tuesday, December 28&lt;/li&gt;
&lt;li&gt;New Year's Day 2028 (Saturday) is observed Monday, January 3, 2028&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I checked those against the GOV.UK bank holidays feed, and my rules produce the same dates. One country pulls the day back across the year line and the other pushes it forward, so "add 1 if Sunday" is not a universal rule.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I took from it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Build holiday maps for a range of years, not one year at a time, and filter afterward.&lt;/li&gt;
&lt;li&gt;Test the boundary years on purpose. 2021/2022 and 2027/2028 are the ones to keep in your test file.&lt;/li&gt;
&lt;li&gt;Compare against the official feed when one exists. GOV.UK publishes JSON; OPM publishes a table per year.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to check a date range without writing the code, the calculator I built shows which holidays it skipped: &lt;a href="https://instantfreetools.com/business-days-calculator/" rel="noopener noreferrer"&gt;Business Days Calculator&lt;/a&gt;. The yearly totals by country are here: &lt;a href="https://instantfreetools.com/business-days-in-a-year/" rel="noopener noreferrer"&gt;Business days in a year&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>A browser stopwatch that stays right when the tab sleeps</title>
      <dc:creator>Kang Jeongsik</dc:creator>
      <pubDate>Mon, 09 Nov 2026 16:12:48 +0000</pubDate>
      <link>https://dev.to/vintage97/a-browser-stopwatch-that-stays-right-when-the-tab-sleeps-2kf0</link>
      <guid>https://dev.to/vintage97/a-browser-stopwatch-that-stays-right-when-the-tab-sleeps-2kf0</guid>
      <description>&lt;p&gt;A stopwatch looks like the easiest tool to build: add 10 ms every 10 ms and print the total. That version is wrong within minutes in a background tab. Here is how the &lt;a href="https://instantfreetools.com/stopwatch/" rel="noopener noreferrer"&gt;stopwatch&lt;/a&gt; on my site keeps time instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't count ticks, subtract timestamps
&lt;/h2&gt;

&lt;p&gt;Browsers slow down timers in hidden tabs, and a phone with the screen off may not run them at all. Any stopwatch that adds up ticks loses exactly that time.&lt;/p&gt;

&lt;p&gt;So the state is three numbers: whether it is running, the moment it was started, and the time banked from earlier runs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;elapsed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;running&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;startedAt&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;startedAt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pause moves the current run into &lt;code&gt;acc&lt;/code&gt; and clears &lt;code&gt;startedAt&lt;/code&gt;. Start sets &lt;code&gt;startedAt&lt;/code&gt; to now. The display timer only decides how often the number is redrawn; it never changes the number. If the tab sleeps for a minute, the next redraw is simply a minute further on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Date.now() and not performance.now()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;performance.now()&lt;/code&gt; is the better clock for measuring, because it doesn't jump if someone changes the computer's clock. But it starts again from zero on every page load, and I wanted the stopwatch to survive a reload. &lt;code&gt;Date.now()&lt;/code&gt; can be saved and compared after a reload, so I chose it and accepted that changing the system clock mid-run will show up in the total.&lt;/p&gt;

&lt;h2&gt;
  
  
  Surviving a reload
&lt;/h2&gt;

&lt;p&gt;The state is saved to the browser's storage after every start, pause and lap. On load it goes through a strict check: &lt;code&gt;running&lt;/code&gt; must be a boolean, &lt;code&gt;acc&lt;/code&gt; and every lap a finite number of zero or more, and a running stopwatch must have a start time. Anything else gives a fresh stopwatch rather than a strange total. In testing I fed it &lt;code&gt;{"running":true,"acc":5}&lt;/code&gt;, a running state with no start time, and it came back as a clean zero.&lt;/p&gt;

&lt;h2&gt;
  
  
  Laps are totals, splits are computed
&lt;/h2&gt;

&lt;p&gt;A lap stores only the total time at that moment. The length of each lap is worked out when the table is drawn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;rows&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;laps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;split&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;laps&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="na"&gt;total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;t&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That keeps the saved data small. With laps at 1:02.34, 2:05.10 and 3:10.87 in total, the splits are 1:02.34, 1:02.76 and 1:05.77, and once there are more than two laps the table marks the fastest and the slowest.&lt;/p&gt;

&lt;p&gt;The display truncates to hundredths rather than rounding, so 65,329 ms shows as 1:05.32. Rounding would sometimes show a time the stopwatch hadn't reached yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Redraw on the second
&lt;/h2&gt;

&lt;p&gt;For a stopwatch, redrawing every few milliseconds is fine. For a clock that shows whole seconds it isn't, because a 1-second interval started at a random moment changes the digits up to a second late. The &lt;a href="https://instantfreetools.com/world-clock/" rel="noopener noreferrer"&gt;world clock&lt;/a&gt; on the same site waits for the next whole second before starting its interval:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;tick&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="nf"&gt;setInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tick&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What I'd tell myself at the start
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Store moments, not counts.&lt;/li&gt;
&lt;li&gt;Decide what has to survive a reload before choosing the clock.&lt;/li&gt;
&lt;li&gt;Validate saved state as if a stranger wrote it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What clock source do you use for timers that need to survive a page reload?&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>showdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What I learned building an alarm clock that lives in a browser tab</title>
      <dc:creator>Kang Jeongsik</dc:creator>
      <pubDate>Sun, 08 Nov 2026 16:42:30 +0000</pubDate>
      <link>https://dev.to/vintage97/what-i-learned-building-an-alarm-clock-that-lives-in-a-browser-tab-2dn5</link>
      <guid>https://dev.to/vintage97/what-i-learned-building-an-alarm-clock-that-lives-in-a-browser-tab-2dn5</guid>
      <description>&lt;p&gt;I built a &lt;a href="https://instantfreetools.com/alarm-clock/" rel="noopener noreferrer"&gt;browser alarm clock&lt;/a&gt; for people who want a quick alarm on a laptop, like a reminder to leave for a meeting or to take something out of the oven. The first thing I had to write on the page was what it can't do: it is not a replacement for your phone's built-in alarm. Here is why, and what I did about each limit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parsing the time people actually type
&lt;/h2&gt;

&lt;p&gt;People type "7:30", "7am", "0730" or "1930". The alarm turns that into the next time that clock time comes round. If it is a quarter past eleven at night and you type 7:30, the alarm is for 7:30 tomorrow morning, and the page shows "in 8 h 15 min" so you can see it understood you.&lt;/p&gt;

&lt;p&gt;The date maths uses the device's local &lt;code&gt;Date&lt;/code&gt;, not a hand-rolled offset:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getFullYear&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getMonth&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getDate&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nx"&gt;h&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;m&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;at&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;now&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;at&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setDate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;at&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getDate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Building the date from local parts and adding a day with &lt;code&gt;setDate&lt;/code&gt; means the browser handles the night the clocks change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Background tabs run late
&lt;/h2&gt;

&lt;p&gt;Browsers slow down timers in tabs you are not looking at, to save battery. Chrome documents this in its &lt;a href="https://developer.chrome.com/blog/timer-throttling-in-chrome-88" rel="noopener noreferrer"&gt;timer throttling notes&lt;/a&gt;, and in practice a background alarm can go off up to about a minute late.&lt;/p&gt;

&lt;p&gt;I can't stop the throttling, so I made sure it can't add up. The alarm never counts ticks. Each check compares the current time with the stored alarm moment, and when the tab becomes visible again a &lt;code&gt;visibilitychange&lt;/code&gt; listener runs that check at once:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;visibilitychange&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;visibilityState&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;visible&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;tick&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="nf"&gt;drawList&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://instantfreetools.com/countdown-timer/" rel="noopener noreferrer"&gt;countdown timer&lt;/a&gt; on the same site works the same way. It stores the moment the timer ends, &lt;code&gt;endAt = Date.now() + left * 1000&lt;/code&gt;, and every tick recomputes what is left from that, so a slow tab shows the right number as soon as you look at it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phones turn the screen off
&lt;/h2&gt;

&lt;p&gt;On a phone, a locked screen usually pauses the page. While an alarm is set, the page asks for a &lt;a href="https://www.w3.org/TR/screen-wake-lock/" rel="noopener noreferrer"&gt;Screen Wake Lock&lt;/a&gt; where the browser supports it, and asks again when the tab comes back, because the browser releases the lock when you switch away. If you lock the phone yourself, most phones pause the page and the alarm won't sound until you unlock it. The page says that in plain words.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sound needs a tap first
&lt;/h2&gt;

&lt;p&gt;Browsers only let a page play sound after the user has pressed something on it. The "Set alarm" and "Test sound" buttons count as that press, so the page creates its &lt;code&gt;AudioContext&lt;/code&gt; there and calls &lt;code&gt;resume()&lt;/code&gt; if the browser has suspended it. If you set an alarm, the sound is already unlocked when it goes off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which time zone?
&lt;/h2&gt;

&lt;p&gt;The alarm uses the device's own clock and time zone. That is the right default for "wake me at 7", but it raises a question I hit while testing: what happens to a time that doesn't exist? In New York on 14 March 2027, the clocks jump from 2:00 to 3:00, so 2:30 never happens. For the alarm, &lt;code&gt;Date&lt;/code&gt; moves it forward on its own. For the &lt;a href="https://instantfreetools.com/time-zone-converter/" rel="noopener noreferrer"&gt;time zone converter&lt;/a&gt; I had to decide explicitly, and it moves 2:30 forward to 3:30, the same choice the clock makes. In November, when 1:30 happens twice, it takes the first one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd keep
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Store the target moment, never a running count.&lt;/li&gt;
&lt;li&gt;Recheck as soon as the tab is visible again.&lt;/li&gt;
&lt;li&gt;Tell people the limits on the page itself, in the first paragraph.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you have built something that has to fire on time from a browser tab, I'd like to hear what you ran into.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>browser</category>
      <category>showdev</category>
    </item>
    <item>
      <title>My calculators gave correct answers to the wrong questions, so I started asking back</title>
      <dc:creator>Kang Jeongsik</dc:creator>
      <pubDate>Sat, 07 Nov 2026 15:45:01 +0000</pubDate>
      <link>https://dev.to/vintage97/my-calculators-gave-correct-answers-to-the-wrong-questions-so-i-started-asking-back-4ge3</link>
      <guid>https://dev.to/vintage97/my-calculators-gave-correct-answers-to-the-wrong-questions-so-i-started-asking-back-4ge3</guid>
      <description>&lt;p&gt;When I tested my calculators the way people actually type, the first problems I found were not about wrong maths. The maths was right. The input was a different number from the one the person meant, and the page answered that number with full confidence. I made these tools, and this is what I changed so they ask back instead: &lt;a href="https://instantfreetools.com/compound-interest-calculator/" rel="noopener noreferrer"&gt;https://instantfreetools.com/compound-interest-calculator/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A 5% rate typed as 0.05
&lt;/h2&gt;

&lt;p&gt;Interest rates show up in two forms. Banks print "5%", and spreadsheets and finance classes write the same rate as 0.05. My compound interest field expects percent, so 0.05 means 0.05%.&lt;/p&gt;

&lt;p&gt;The gap is large. $10,000 for 10 years at 5% compounded monthly grows to $16,470.09. At 0.05% it grows to $10,050.12. Both results are correct for what was typed. Only one of them is what the person wanted.&lt;/p&gt;

&lt;p&gt;The tempting fix is to multiply anything below 1 by 100. I didn't do that, because a 0.5% savings rate is real, and silently turning it into 50% would be worse than the original problem. So the page keeps using the number as typed and asks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;decimalRate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;e8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;e6&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the rate is above 0 and below 1, a line appears under the result: "Using 0.05%. Did you mean 5%?" with a button that puts 5 in the field. For 0.5 it asks about 50%, and the person can ignore it. For 5 it says nothing. The rounding is there because 0.07 * 100 in floating point is not exactly 7, and I don't want to show "7.000000000000001%" in a question.&lt;/p&gt;

&lt;p&gt;One bug came from the button itself. The hint redraws on every change of the field, and clicking the button changes the field. The first version rebuilt the hint while the click was still happening, so the button vanished before the click registered. Now the hint only redraws when the suggested value is different from the one already shown.&lt;/p&gt;

&lt;h2&gt;
  
  
  Height in metres in a centimetres box
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://instantfreetools.com/bmi-calculator/" rel="noopener noreferrer"&gt;BMI calculator&lt;/a&gt; has a height field labelled cm. In testing I typed 1.75, the way many people write their height. With 70 kg that gives 70 ÷ 0.0175², which is a BMI of 228,571.4, and the page showed it next to a category name.&lt;/p&gt;

&lt;p&gt;Here a silent fix is safe, because no adult is 1.75 cm tall. Any value between 0 and 3 in the cm box is read as metres:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;readCm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;cm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;meters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;cm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;meters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result then says "Read 1.75 as 175 cm.", so the conversion is not hidden. With 70 kg that comes to 22.9, Healthy weight.&lt;/p&gt;

&lt;p&gt;The second part of the fix was a plausibility check. Height has to be between 50 and 272 cm and weight between 2 and 650 kg. Outside that range the page shows no BMI and asks the person to check the numbers. A wrong-but-plausible number is still possible, but an absurd one no longer gets a label.&lt;/p&gt;

&lt;p&gt;The rule I ended up with: if a misreading is impossible, convert it and say so. If it is possible, keep the input and ask.&lt;/p&gt;

&lt;h2&gt;
  
  
  Commas, dots and currency symbols
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://instantfreetools.com/percentage-calculator/" rel="noopener noreferrer"&gt;percentage calculator&lt;/a&gt; gets pasted input, and pasted numbers are messy. People paste "$80", "12.5%", "1,250", and from much of Europe, "12,5" meaning twelve and a half. A plain &lt;code&gt;Number()&lt;/code&gt; rejects most of these, and &lt;code&gt;parseFloat("1,250")&lt;/code&gt; returns 1.&lt;/p&gt;

&lt;p&gt;The parser strips spaces, the percent sign and common currency symbols, then decides what a comma means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"1,250" has exactly three digits after the comma, so it is a thousands separator: 1250.&lt;/li&gt;
&lt;li&gt;"12,5" and "1,25" do not, so the comma is a decimal point: 12.5 and 1.25.&lt;/li&gt;
&lt;li&gt;"1.250,5" is the European full form: 1250.5.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a guess, and it can be wrong. "1,250" written by a German user meaning 1.25 will be read as 1250. I kept the US reading because the site is in English, and the working line under each result shows the number that was used ("12.5% × 80 = 10"), so a misread is visible right away.&lt;/p&gt;

&lt;h2&gt;
  
  
  Floating point in the output
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;0.1 + 0.2&lt;/code&gt; is 0.30000000000000004 in JavaScript, and people do type 0.1 and 0.2. Every percentage result goes through one function before display:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tidy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parseFloat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toPrecision&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Twelve significant digits keeps every realistic result exact and removes the binary noise, so the answer shows 0.3.&lt;/p&gt;

&lt;p&gt;The same page has a worked example that surprises people more than any bug: add 10% to 100 and you get 110, then take 10% off and you get 99, not 100. That one is correct, and the calculator shows both steps so it doesn't look like an error.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed in how I build these
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Every input field has a "what if they type the other unit" test. For rates that is 0.05 against 5. For height it is 1.75 against 175.&lt;/li&gt;
&lt;li&gt;Converting silently is only allowed when the other reading is physically impossible. Otherwise the page asks.&lt;/li&gt;
&lt;li&gt;The page shows the number it actually used, next to the result. It costs one line and it catches mistakes the hint logic never thought of.&lt;/li&gt;
&lt;li&gt;The hint has to survive being clicked. It sounds obvious, but my first version failed it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of this is clever code. Most of it came from testing the inputs people are likely to type. If you have run into a version of this problem in your own forms, such as dates, phone numbers or units, I'd like to hear how you handled it.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>ux</category>
      <category>showdev</category>
    </item>
    <item>
      <title>How I count business days with public holidays in JavaScript (rules, an API, and the corrections it needed)</title>
      <dc:creator>Kang Jeongsik</dc:creator>
      <pubDate>Sat, 07 Nov 2026 07:26:33 +0000</pubDate>
      <link>https://dev.to/vintage97/how-i-count-business-days-with-public-holidays-in-javascript-rules-an-api-and-the-corrections-it-4mm2</link>
      <guid>https://dev.to/vintage97/how-i-count-business-days-with-public-holidays-in-javascript-rules-an-api-and-the-corrections-it-4mm2</guid>
      <description>&lt;p&gt;Every online business day calculator I tried gave me a slightly different answer for the same two dates, and none of them showed which days they had skipped. So I wrote my own and put the skipped days on a calendar under the result. I made this tool: &lt;a href="https://instantfreetools.com/business-days-calculator/" rel="noopener noreferrer"&gt;https://instantfreetools.com/business-days-calculator/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This post is about how the counting works, because most of the bugs were not where I expected them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The count itself is the easy part
&lt;/h2&gt;

&lt;p&gt;A business day is a date that is not a weekend day, not a public holiday and not a day off you added yourself. The core loop is boring on purpose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;isBusinessDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;weekend&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;holidays&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;custom&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;iso&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;toISO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dt&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;weekend&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUTCDay&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;iso&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;holidays&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;custom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;iso&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;weekend&lt;/code&gt; is a Set of weekday numbers (0 is Sunday), so a Friday and Saturday weekend is &lt;code&gt;new Set([5, 6])&lt;/code&gt; instead of a special case. &lt;code&gt;holidays&lt;/code&gt; is a plain object keyed by &lt;code&gt;YYYY-MM-DD&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The counter walks from the start date to the end date one day at a time. That sounds slow, but a span of ten years is about 3,650 iterations, which is nothing. A closed-form formula would be faster, but every holiday you add makes it harder to get right, and the loop has one more benefit: while it walks, it can record each weekday it skipped and the reason. That list is what draws the calendar.&lt;/p&gt;

&lt;p&gt;All dates are created with &lt;code&gt;Date.UTC&lt;/code&gt; and read with &lt;code&gt;getUTCDay()&lt;/code&gt;. If you mix local time in, a date can move by a day around a daylight saving change, and you get an off-by-one error that only shows up two nights a year.&lt;/p&gt;

&lt;h2&gt;
  
  
  Include the start date or not?
&lt;/h2&gt;

&lt;p&gt;This is where calculators disagree most. Excel's &lt;code&gt;NETWORKDAYS&lt;/code&gt; counts both the start and the end date. &lt;code&gt;WORKDAY&lt;/code&gt;, which adds days, does not count the start date. So "10 business days from 20 November" and "business days from 20 November to 4 December" are answering different questions.&lt;/p&gt;

&lt;p&gt;I made both ends a checkbox and kept the Excel behaviour as the default, then printed the matching formula next to the result so people can check it in a spreadsheet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;=NETWORKDAYS.INTL(DATE(2026,11,6), DATE(2026,12,31), "0000011", H2:H4)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The seven-character string is the weekend, Monday first, with 1 for a day off. "0000011" is Saturday and Sunday, and "0000110" is Friday and Saturday. Building it from the same Set the counter uses means the formula and the result can't drift apart.&lt;/p&gt;

&lt;p&gt;For the US, 6 November to 31 December 2026 comes out at 37 business days: 40 weekdays minus Veterans Day, Thanksgiving and Christmas. The H2:H4 range is those three dates. If you only need the calendar-day count, the &lt;a href="https://instantfreetools.com/days-between-dates/" rel="noopener noreferrer"&gt;days between dates&lt;/a&gt; page does that without skipping weekends.&lt;/p&gt;

&lt;h2&gt;
  
  
  US federal holidays: the observed rule
&lt;/h2&gt;

&lt;p&gt;Most US federal holidays are either a fixed date or "the nth Monday of a month". The fixed ones have a catch: if one falls on a Saturday, the day off is the Friday before, and on a Sunday it is the Monday after.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;usObserved&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;dt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUTCDay&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;addDays&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;w&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;addDays&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;dt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In 2026 Independence Day is a Saturday, so the holiday in the calculator is Friday 3 July.&lt;/p&gt;

&lt;p&gt;The case that broke my first version was New Year's Day 2028, which is a Saturday. Its observed day is Friday 31 December 2027, in the previous year. If you build holidays one year at a time, that day lands in the wrong year's list or disappears. Now the code checks next year's 1 January while building this year, and drops this year's own 1 January if it moved back into last year. December 2027 has 21 business days in the US, with both 24 December (Christmas observed) and 31 December skipped.&lt;/p&gt;

&lt;p&gt;Two holidays also need a start year: Martin Luther King Jr. Day from 1986 and Juneteenth from 2021. Without that, counts for older dates are off by one.&lt;/p&gt;

&lt;h2&gt;
  
  
  England and Wales: computing Easter
&lt;/h2&gt;

&lt;p&gt;UK bank holidays for England and Wales include Good Friday and Easter Monday, so you need Easter Sunday. There is a well-known arithmetic method for the Gregorian calendar (often credited to Meeus, Jones and Butcher) that needs no tables. For 2027 it gives 28 March, which puts Good Friday on 26 March and Easter Monday on 29 March. UK bank holidays that fall on a weekend move to the next weekday, which is a different rule from the US one.&lt;/p&gt;

&lt;p&gt;I checked both sets against the official tables (the GOV.UK bank holidays JSON and the OPM federal holiday pages) and kept those dates as tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Everywhere else: an API, then corrections
&lt;/h2&gt;

&lt;p&gt;Writing rules for 200 more countries by hand was not realistic. For the rest I use the free Nager.Date API. The browser sends only a country code and a year, and the dates you type stay on your device. Results are cached per country and year, so changing the dates does not refetch.&lt;/p&gt;

&lt;p&gt;The data is good but not perfect, and I found a few gaps by comparing it with official calendars:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Japan: a weekday between two holidays becomes a holiday too (the "citizens' holiday"). In 2026 that makes 22 September a day off, between Respect for the Aged Day on the 21st and the Autumnal Equinox on the 23rd. The API did not have it, so the code adds it from the rule.&lt;/li&gt;
&lt;li&gt;South Korea: a few temporary and substitute holidays were missing, and for holidays moved off a weekend the original date had been dropped. The code puts both back.&lt;/li&gt;
&lt;li&gt;Brazil: Corpus Christi is listed as a national holiday, but at the federal level it is an optional day, so it is removed.&lt;/li&gt;
&lt;li&gt;Mexico: Labour Day is fixed by law on 1 May, and the code pins it there.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These corrections are pure functions that take the holiday map and return a new one, so each has a small test with the official dates.&lt;/p&gt;

&lt;p&gt;I also limit the API to 1990 through 2035. Outside that range the values look generated from rules rather than published, and I would rather show an error than a confident wrong number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things I'd tell myself at the start
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Store dates as &lt;code&gt;YYYY-MM-DD&lt;/code&gt; strings and do the maths in UTC. Most of my bugs went away after that.&lt;/li&gt;
&lt;li&gt;Decide what "from" and "to" mean before writing code, and show the user the choice.&lt;/li&gt;
&lt;li&gt;Show the skipped days. Nobody trusted the number until they could see why it was 37 and not 40.&lt;/li&gt;
&lt;li&gt;Holiday data needs checking against official sources. Treat any dataset, mine included, as a starting point.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you know a country or year where the observed-holiday rules get strange, I would really like to hear about it in the comments.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>showdev</category>
      <category>datetime</category>
    </item>
    <item>
      <title>How to respect robots.txt and Crawl-delay in Python</title>
      <dc:creator>Kang Jeongsik</dc:creator>
      <pubDate>Fri, 16 Oct 2026 05:15:24 +0000</pubDate>
      <link>https://dev.to/vintage97/how-to-respect-robotstxt-and-crawl-delay-in-python-5d22</link>
      <guid>https://dev.to/vintage97/how-to-respect-robotstxt-and-crawl-delay-in-python-5d22</guid>
      <description>&lt;p&gt;A polite scraper checks &lt;code&gt;robots.txt&lt;/code&gt; before each host, identifies itself, and slows down. This post shows how to do that with Python's standard library, and how the small open-source scraper in &lt;a href="https://github.com/raxsoft-sudo/python-automation-starter" rel="noopener noreferrer"&gt;python-automation-starter&lt;/a&gt; handles it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What robots.txt is, and is not
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;robots.txt&lt;/code&gt; is a plain-text file at the root of a site (&lt;code&gt;https://example.com/robots.txt&lt;/code&gt;) listing which paths automated clients should avoid, and sometimes a &lt;code&gt;Crawl-delay&lt;/code&gt;. It is a convention, not access control and not a legal permission. Terms of service, copyright and privacy law still apply. If a site says no, the right move is to skip it.&lt;/p&gt;

&lt;h2&gt;
  
  
  A sensible policy
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Fetch &lt;code&gt;robots.txt&lt;/code&gt; once per host, with your own User-Agent, and cache it.&lt;/li&gt;
&lt;li&gt;On HTTP 200, parse the rules.&lt;/li&gt;
&lt;li&gt;On a 4xx (for example 404), treat everything as allowed. That is the usual reading.&lt;/li&gt;
&lt;li&gt;On a 5xx or a network failure, assume everything is &lt;strong&gt;disallowed&lt;/strong&gt;, to be conservative.&lt;/li&gt;
&lt;li&gt;Skip disallowed URLs and log why.&lt;/li&gt;
&lt;li&gt;If the file has a &lt;code&gt;Crawl-delay&lt;/code&gt; larger than your own delay, raise your delay to match.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Test the parser offline
&lt;/h2&gt;

&lt;p&gt;You can see exactly how Python interprets a robots.txt without any network:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;urllib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;robotparser&lt;/span&gt;

&lt;span class="n"&gt;rp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;robotparser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;RobotFileParser&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;rp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;User-agent: *
Crawl-delay: 5
Disallow: /private/&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splitlines&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;can_fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MyBot&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://x.test/private/a&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;  &lt;span class="c1"&gt;# False
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;can_fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MyBot&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://x.test/ok&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;         &lt;span class="c1"&gt;# True
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;crawl_delay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MyBot&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;                            &lt;span class="c1"&gt;# 5
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output when run: &lt;code&gt;False True 5&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set your identity and delay
&lt;/h2&gt;

&lt;p&gt;Use a User-Agent that lets site owners contact you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python static_list_scraper.py https://quotes.toscrape.com/ &lt;span class="nt"&gt;-c&lt;/span&gt; configs/quotes.json &lt;span class="nt"&gt;-o&lt;/span&gt; quotes.csv &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--user-agent&lt;/span&gt; &lt;span class="s2"&gt;"MyResearchBot/1.0 (contact: me@example.org)"&lt;/span&gt; &lt;span class="nt"&gt;--delay&lt;/span&gt; 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A 1-second delay is a minimum, not a goal. For anything bigger than a few pages, use 2 to 5 seconds, and scrape at quiet hours if you can.&lt;/p&gt;

&lt;h2&gt;
  
  
  What not to do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Do not use an "ignore robots" switch to get around a block. Keep it for your own sites and test servers.&lt;/li&gt;
&lt;li&gt;Do not rotate User-Agents or IPs to hide your scraper.&lt;/li&gt;
&lt;li&gt;Do not hit a single host with parallel requests unless the owner agrees.&lt;/li&gt;
&lt;li&gt;Prefer an official API or data export when one exists.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common errors
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Everything blocked on a site that looks fine&lt;/strong&gt;: its robots.txt returned a 5xx error. Retry later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rules differ by bot name&lt;/strong&gt;: a &lt;code&gt;User-agent: MyBot&lt;/code&gt; section applies only if your User-Agent string starts with that name. Otherwise the &lt;code&gt;*&lt;/code&gt; section applies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Crawl-delay ignored in your own code&lt;/strong&gt;: &lt;code&gt;urllib.robotparser&lt;/code&gt; only reports it; you must sleep yourself.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;The full code (scraper + retry/backoff + CSV/JSON export) is MIT on GitHub: &lt;a href="https://github.com/raxsoft-sudo/python-automation-starter" rel="noopener noreferrer"&gt;https://github.com/raxsoft-sudo/python-automation-starter&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you'd rather not run it yourself, the same CSS-selector extraction is a hosted API with a free tier: &lt;a href="https://rapidapi.com/%EA%B0%95%EC%A0%95%EC%8B%9D/api/scrape-to-json1" rel="noopener noreferrer"&gt;https://rapidapi.com/%EA%B0%95%EC%A0%95%EC%8B%9D/api/scrape-to-json1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This post was written with AI assistance and the code was run and checked before publishing.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>webscraping</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How I Survived 7 Rebuilds of the Same SaaS by Building a Control Layer Around Claude Code</title>
      <dc:creator>Kang Jeongsik</dc:creator>
      <pubDate>Wed, 20 May 2026 06:02:42 +0000</pubDate>
      <link>https://dev.to/vintage97/how-i-survived-7-rebuilds-of-the-same-saas-by-building-a-control-layer-around-claude-code-21dh</link>
      <guid>https://dev.to/vintage97/how-i-survived-7-rebuilds-of-the-same-saas-by-building-a-control-layer-around-claude-code-21dh</guid>
      <description>&lt;p&gt;I'm a solo founder. Over the past month I rebuilt the same B2B SaaS codebase seven times. Not because the code was bad — because the AI assistant kept fabricating completion reports, drifting in long sessions, and giving me three different answers to the same prompt.&lt;/p&gt;

&lt;p&gt;After rebuild number seven I stopped writing product code for two days. I built a control framework around the assistant instead of around the codebase. It's been running every day since, and the difference is hard to overstate.&lt;/p&gt;

&lt;p&gt;This post is the short version of what's inside.&lt;/p&gt;

&lt;h2&gt;
  
  
  The core problem
&lt;/h2&gt;

&lt;p&gt;The failure mode wasn't "the model is dumb." It was that the model is &lt;strong&gt;convincing when it's wrong&lt;/strong&gt;. Three patterns kept killing me:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fabricated completion reports.&lt;/strong&gt; "Task complete, all tests pass." No tests were run. No tests existed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long-session drift.&lt;/strong&gt; At 60% context, the model started contradicting decisions it had made 20 turns earlier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompt-layer guardrails get ignored.&lt;/strong&gt; I tried system prompts, custom instructions, every prompt trick. The model agreed politely and then did whatever it wanted.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The insight that changed everything: &lt;strong&gt;if prompts get ignored, move the guardrails out of the prompt layer and into the protocol layer.&lt;/strong&gt; Hooks. Not instructions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's in the kit
&lt;/h2&gt;

&lt;p&gt;Single release. No subscription. Designed for solo developers who are 3+ rebuilds in and tired.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;3 hooks&lt;/strong&gt; that block fabricated reports at the protocol layer. Pre-tool-use, post-tool-use, subagent-stop. They don't ask the model to be honest. They refuse to accept output that fails an objective check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;17 sub-agent definitions&lt;/strong&gt; in 4 teams: research, build, verify, ship. Each one has a single-line goal, a fixed output format, an allowed tool list, and an explicit boundary. If a sub-agent tries to step outside its boundary, the hook stops it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;5 SSOT files&lt;/strong&gt; (single source of truth): wiki, wiki-detail, status, decisions, false-report log. The false-report log is the most important — it's where every "I lied" event gets recorded so the same lie can't slip through twice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2 RAG embedding scripts&lt;/strong&gt; for pulling project memory back into context without bloating the prompt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;13 case studies&lt;/strong&gt; from the seven-rebuild retrospective. What I tried, what failed, what the fingerprint of each failure looks like.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Setup script&lt;/strong&gt; with an explicit consent prompt before it touches anything.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A taste of what the hook layer looks like
&lt;/h2&gt;

&lt;p&gt;This isn't the actual hook (the real ones are in the archive) — it's the shape. The point is that hooks live outside the model's reach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# subagent-stop hook: reject reports that claim completion&lt;/span&gt;
&lt;span class="c"&gt;# without referencing any verification step&lt;/span&gt;

&lt;span class="nv"&gt;report&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-qEi&lt;/span&gt; &lt;span class="s2"&gt;"(complete|finished|done|100%)"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$report&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-qEi&lt;/span&gt; &lt;span class="s2"&gt;"(test|verified|checked|ran)"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$report&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"blocked: completion claim with no verification reference"&lt;/span&gt;
    &lt;span class="nb"&gt;exit &lt;/span&gt;2
  &lt;span class="k"&gt;fi
fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model can be as creative as it wants inside the prompt. The hook doesn't read the prompt. It reads the output and checks structure. If the structure doesn't match the contract, exit code 2, and the report is rejected at the protocol layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Numbers from my own project
&lt;/h2&gt;

&lt;p&gt;Unverified, single-author, on one codebase. Take with a grain of salt:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Weekly task time&lt;/td&gt;
&lt;td&gt;~40h&lt;/td&gt;
&lt;td&gt;~8h&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Output accuracy&lt;/td&gt;
&lt;td&gt;~40%&lt;/td&gt;
&lt;td&gt;~95%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fabricated reports / week&lt;/td&gt;
&lt;td&gt;~13&lt;/td&gt;
&lt;td&gt;0-1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The "0-1" line matters more than the "95%." A loud failure I can catch. A silent fabrication is what burns a week.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I'm sharing
&lt;/h2&gt;

&lt;p&gt;I was going to keep it private. Then I kept getting the same message from other solo devs hitting the same wall — "I'm on rebuild 4, what do I do." So I packaged the framework I was already using.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://raxsoft.gumroad.com/l/aiacf" rel="noopener noreferrer"&gt;Gumroad page&lt;/a&gt; is a free preview — full README, ICP, before/after, FAQ. Read everything before deciding. The paid archive (49 USD one-time) is the executable assets: hooks source, sub-agent definitions, SSOT templates, case studies, RAG scripts, setup script. No subscription, no updates, no support — single release. MIT for code, CC BY-NC for docs.&lt;/p&gt;

&lt;p&gt;If you're 3+ rebuilds in and the assistant is still fabricating reports, I'm in the comments. Happy to talk specifics.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>claude</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
