Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your birth time is lying to you: a time-zone rabbit hole in a Chinese astrology calculator

I built a calculator for BaZi — Chinese "Four Pillars" birth charts. Whatever you think of the interpretive tradition (and I'll get to that), the input math turned out to be a genuinely deep time-zone problem, and that's what this post is about. If you've ever thought "time zones, how hard can it be" — this is a tour of exactly how hard, with working TypeScript. The problem BaZi divides the day…

A Chinese astrology calculator for BaZi, or Four Pillars birth charts, reveals a time-zone rabbit hole. Birth chart calculations rely on solar time, which differs from clock time. Three factors contribute to this discrepancy: daylight saving time, longitude, and the equation of time. For instance, a July birth in Vancouver requires a roughly 78-minute correction.

To calculate the offset from UTC for a specific time zone, the code utilizes the Intl.DateTimeFormat API, which ships the full IANA tzdb, including historical oddities. By formatting a UTC instant in any zone and parsing the formatted parts, the offset can be obtained without bundling tz data.

A subtler issue arises when determining the standard offset due to Daylight Saving Time (DST), which lacks a dedicated API in JavaScript. The code employs a heuristic by sampling the zone's offset on specific dates (January 1, July 1, and the birth instant) and selecting the minimum value as the standard offset.

One edge case is the date line, where the naive calculation using longitude × 4 minutes from Greenwich results in a full-day error in the local mean solar time. To address this, the code normalizes the longitude to within ±180° of the zone's standard meridian.

Another edge case is Morocco's negative DST during Ramadan, which the heuristic addresses by taking the minimum offset among sample dates. The three components—the date, time, and DST—can be displayed in an addition table, revealing the complex relationship between time zones and BaZi chart calculations.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

If your MCP server uses OAuth, every directory thinks it has zero tools

We shipped a remote MCP server, registered it everywhere, and then noticed something odd: every directory listed it as having no tools at all . Not the wrong tools. Not a stale count. Zero.

  • OAuth 2.1 authentication hides server's tool capabilities
  • Tools/list JSON-RPC method requires authenticated user
  • Separating public and authenticated methods resolves issue

From Prompt to Playable: Building a Phaser Survival Game with Codex and SpriteShip

There is a big difference between a game prototype that technically works and one that feels like a game. Movement, spawning, upgrades, and collision can be built with colored rectangles.

  • Combines Phaser 3, Codex, and SpriteShip for top-down survival game
  • Generates animated characters, enemies, weapons, collectibles, and boss encounter
  • Streamlined asset integration speeds up development process

Hello Everyone

Hello everyone, I am new to coding just begun to learn the ins and outs of coding and what it can do. I am in the process of getting my Full Stack Developer certificates.

More from Saturday 22 August →