Menu

The hard part of a BaZi calculator isn't the astrology - it's the time zones
πŸ“°

The hard part of a BaZi calculator isn't the astrology - it's the time zones

DEV Community: backendΒ·YizeΒ·7 days ago
#PJU95U0G
#devtobackend#devto#dev#time#solar
Long article (899 words) β€” no AI summary yet.
Reading 0:00
15s threshold

When I started building a BaZi (Four Pillars) calculator, I assumed the hard part would be the astrology β€” the rules, the terminology, the interpretation. The rules turned out to be a lookup table. The hard part was that every birth record in the world gives you a time that isn't the time the calculation actually needs.

Here are the five traps, roughly in the order they bit me.

1. IANA time zones are city-based. Birthplaces are not.

Asia/Shanghai has been a flat +08:00 since 1901. That's true for the zone. It is not true for a birthplace.

China spans about 60 degrees of longitude and uses a single zone. Standard time is defined at 120Β°E. Chengdu sits at 104.07Β°E:

(104.07 - 120) Γ— 4 minutes per degree β‰ˆ -64 minutes

Enter fullscreen mode

Exit fullscreen mode

Local mean time in Chengdu runs roughly 64 minutes behind the clock on the wall.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.