{"slug": "korean-saju-has-four-calendar-edge-cases-that-break-naive-date-math", "title": "Korean saju has four calendar edge cases that break naive date math", "summary": "A developer built K-Fortune, an English-language voice reader for Korean saju (four pillars) charts, and reports that the hard part was calendar arithmetic rather than the LLM. The system computes the chart deterministically in code — handling the Ipchun year boundary, jeol solar terms stored as UTC instants, the 23:00 day rollover convention, and true solar time correction for Seoul — and passes the rendered eight characters to AI reader voices that interpret but never calculate. The developer warns that models asked to compute pillars directly produce plausible-looking but wrong charts.", "body_md": "Every \"Year of the Goat\" post you will read this month assumes 2027 starts on the same day. For a saju (four pillars) chart it does not even start at the same month boundary. I spent the last weeks building an English-language voice reader for Korean saju, and almost none of the hard work was the LLM. It was the calendar.\n\nHere are four places where naive date math quietly produces the wrong chart.\n\nBoth Korean saju and Chinese BaZi change the year pillar at Ipchun (立春), the \"start of spring\" solar term. In 2027 that is February 4. Lunar New Year is February 6.\n\nA baby born on February 5, 2027 is a Goat in saju and still a Horse in the popular lunar count. Same baby, two animals, depending on which rule your code implements.\n\nIf you build on `getFullYear()` or on a lunar calendar library alone, you get the wrong year pillar for everyone born in that gap.\n\nMonth pillars turn on the twelve jeol solar terms — Sohan, Ipchun, Gyeongchip and so on — not on the first of the month. Those terms are astronomical events with a time, not a date.\n\nThe subtle bug: the same instant is a different local time in Seoul and in Beijing. Korea computes terms in KST (UTC+9); many BaZi implementations compute them in Beijing time (UTC+8). A birth within an hour of a term boundary gets a different month pillar under the two conventions, and that changes the ten-god mapping derived from it.\n\nStore term times as UTC instants, then convert with the birth location's offset. Do not store \"Feb 4\" as a date.\n\nKorean saju commonly starts the new day at 23:00 — the \"night rat hour\" convention — while many Chinese schools roll the day at 00:00. Someone born at 23:30 gets two different day pillars under the two rules, and the day pillar is the one Korean readers look at first for relationships and work.\n\nPick one convention, write it down in the product, and test it. If you \"fix\" it later, every chart you already generated changes.\n\nKorea's standard meridian is 135°E, but Seoul sits near 127°E — about 32 minutes of solar offset. Korean saju explicitly corrects for this (진태양시). Plenty of implementations do not.\n\nHalf an hour of clock time is enough to cross a two-hour hour-pillar boundary. Two apps, same birth certificate, different hour pillar, and then two different readings of the same life.\n\nThe failure mode is not that the model is wrong. It is that it is plausible.\n\nAsk a model to \"calculate the four pillars\" and it will happily produce eight characters that look right, with the correct hanja and the correct format. They are guesses. The chart is deterministic arithmetic; the model should never be the one doing it.\n\nThe shape that worked for us:\n\n```\nchart = saju.chart(\n    birth=Birth(dt_utc=..., tz=\"Asia/Seoul\", place=seoul),\n    year_boundary=\"ipchun\",\n    day_rollover=\"23:00\",\n    true_solar_time=True,\n)\n\nprompt = render(chart)         # eight characters + ten gods + luck cycle\nanswer = reader_voice(prompt)  # the model interprets, never computes\n```\n\nThen the golden tests that actually caught bugs:\n\nI built K-Fortune on top of this: Korean saju read in English, out loud, by a set of AI reader voices. You enter a birth date, time and place, choose a voice, and the reading is generated from the computed chart instead of a sun-sign template. There is a one-minute free call to hear the format; a full five-minute reading is $7.99.\n\n[https://k-saju-voice.onrender.com](https://k-saju-voice.onrender.com)\n\nThese are AI readers, not human fortune tellers, and the purpose is self-reflection and entertainment — not medical, legal or financial advice.\n\nTwo things I am still unsure about.\n\nIf you have built consumer voice products, I would like to hear how you handle both.", "url": "https://wpnews.pro/news/korean-saju-has-four-calendar-edge-cases-that-break-naive-date-math", "canonical_source": "https://dev.to/kfortune/korean-saju-has-four-calendar-edge-cases-that-break-naive-date-math-228g", "published_at": "2026-12-05 23:28:52+00:00", "updated_at": "2026-12-05 23:44:37.914881+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-products", "ai-tools"], "entities": ["K-Fortune", "Seoul", "Korea"], "also_reported_by": [], "takeaway": "Compute saju pillars deterministically in code — storing solar-term times as UTC instants and pinning year boundary, day rollover and true-solar-time conventions — and let the LLM only interpret the rendered chart, since models asked to calculate pillars return plausible but wrong characters.", "recommendation": {"advice": "Move deterministic arithmetic like calendar and pillar computation out of the model into tested code, and pass the computed result to the LLM only for interpretation.", "playbook": "output-verification", "playbook_url": "https://wpnews.pro/playbooks/output-verification"}, "alternates": {"html": "https://wpnews.pro/news/korean-saju-has-four-calendar-edge-cases-that-break-naive-date-math", "markdown": "https://wpnews.pro/news/korean-saju-has-four-calendar-edge-cases-that-break-naive-date-math.md", "text": "https://wpnews.pro/news/korean-saju-has-four-calendar-edge-cases-that-break-naive-date-math.txt", "jsonld": "https://wpnews.pro/news/korean-saju-has-four-calendar-edge-cases-that-break-naive-date-math.jsonld"}}