<?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: Pingtou</title>
    <description>The latest articles on DEV Community by Pingtou (@juto).</description>
    <link>https://dev.to/juto</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%2F4226393%2F4aa003b8-95fc-41ce-8b0f-b90dd0a3e276.png</url>
      <title>DEV Community: Pingtou</title>
      <link>https://dev.to/juto</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/juto"/>
    <language>en</language>
    <item>
      <title>Calculating True Solar Time (真太阳时): Longitude Offset and the Equation of Time in Calendar Algorithms</title>
      <dc:creator>Pingtou</dc:creator>
      <pubDate>Wed, 04 Nov 2026 14:28:19 +0000</pubDate>
      <link>https://dev.to/juto/calculating-true-solar-time-zhen-tai-yang-shi-longitude-offset-and-the-equation-of-time-in-calendar-algorithms-5fb</link>
      <guid>https://dev.to/juto/calculating-true-solar-time-zhen-tai-yang-shi-longitude-offset-and-the-equation-of-time-in-calendar-algorithms-5fb</guid>
      <description>&lt;p&gt;When building high-precision East Asian calendar engines or Four Pillars (&lt;em&gt;Bazi&lt;/em&gt; / 八字) astrolabes, relying on standard civil clock time—such as UTC+8 (China Standard Time)—introduces significant astronomical errors. &lt;/p&gt;

&lt;p&gt;Standard time zones are geopolitical constructs. For instance, the entire landmass of China shares a single time zone anchored at the &lt;strong&gt;120°E meridian&lt;/strong&gt;, even though the country spans longitudes from roughly 73°E to 135°E. In traditional horology and &lt;em&gt;Ganzhi&lt;/em&gt; (干支) hour-pillar calculations, the day is divided into 12 double-hours (&lt;em&gt;Shichen&lt;/em&gt; / 时辰) based strictly on the actual position of the sun relative to the local observer's meridian.&lt;/p&gt;

&lt;p&gt;To accurately determine the &lt;em&gt;Shichen&lt;/em&gt; boundary (especially the critical transition at 23:00 for the &lt;em&gt;Zi&lt;/em&gt; hour / 子时), an algorithm must convert civil clock time into &lt;strong&gt;Local Apparent Solar Time (真太阳时 / True Solar Time)&lt;/strong&gt;. This conversion requires a two-step astronomical correction:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Geographic Longitude Offset (经度时差)&lt;/strong&gt; — converting standard zone time to Local Mean Solar Time (平太阳时).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Equation of Time (均时差)&lt;/strong&gt; — correcting for Earth's elliptical orbit and axial tilt.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 1: Geographic Longitude Correction (Local Mean Solar Time)
&lt;/h2&gt;

&lt;p&gt;The Earth rotates 360° in approximately 24 hours (1,440 minutes), which translates to &lt;strong&gt;1° every 4 minutes&lt;/strong&gt; (or 1' of arc every 4 seconds).&lt;/p&gt;

&lt;p&gt;If a civil clock is synchronized to a standard meridian &lt;code&gt;λ_std&lt;/code&gt; (e.g., 120°E for UTC+8), any observer located at local longitude &lt;code&gt;λ_local&lt;/code&gt; experiences solar noon earlier or later than the standard meridian:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Δt_lon = (λ_local - λ_std) × 4 minutes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Example:&lt;/strong&gt; For an observer in Chengdu (&lt;code&gt;λ_local ≈ 104.06°E&lt;/code&gt;), the local mean solar time lags behind Beijing Standard Time by:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(104.06 - 120.0) × 4 = -63.76 minutes ≈ -1 hour 3 minutes 46 seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, even after applying this geographic offset, the sun still does not cross the local meridian at exactly 12:00:00 Local Mean Time. That brings us to the orbital mechanics of the Earth.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: The Equation of Time (均时差)
&lt;/h2&gt;

&lt;p&gt;Local Mean Solar Time assumes a fictitious "mean sun" moving along the celestial equator at a uniform speed. In reality, apparent solar time fluctuates throughout the year due to two Keplerian factors:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Orbital Eccentricity (&lt;code&gt;e ≈ 0.0167&lt;/code&gt;):&lt;/strong&gt; According to Kepler's Second Law, Earth moves faster near perihelion (early January) and slower near aphelion (early July).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Obliquity of the Ecliptic (&lt;code&gt;ε ≈ 23.44°&lt;/code&gt;):&lt;/strong&gt; The projection of the sun's ecliptic motion onto the celestial equator varies seasonally.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The cumulative discrepancy between apparent solar time and mean solar time is known in positional astronomy as the &lt;a href="https://en.wikipedia.org/wiki/Equation_of_time" rel="noopener noreferrer"&gt;Equation of Time&lt;/a&gt; (&lt;code&gt;EoT&lt;/code&gt;). It ranges from approximately &lt;strong&gt;-14 minutes 6 seconds&lt;/strong&gt; (around February 11) to &lt;strong&gt;+16 minutes 33 seconds&lt;/strong&gt; (around November 3).&lt;/p&gt;

&lt;h3&gt;
  
  
  Spencer's Fourier Series Approximation
&lt;/h3&gt;

&lt;p&gt;For most calendrical and &lt;em&gt;Bazi&lt;/em&gt; software applications, solving Kepler's equation iteratively is unnecessary. J.W. Spencer (1971) derived a highly reliable Fourier series approximation for the Equation of Time, accurate to within ~30 seconds.&lt;/p&gt;

&lt;p&gt;Given the day angle &lt;code&gt;B&lt;/code&gt; (in radians) for day &lt;code&gt;N&lt;/code&gt; of the year (where &lt;code&gt;N = 1&lt;/code&gt; on January 1):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;B = 2π × (N - 1) / 365
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Equation of Time (in minutes) is expressed as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EoT = 229.18 × (0.000075 + 0.001868·cos(B) - 0.032077·sin(B) - 0.014615·cos(2B) - 0.040849·sin(2B))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 3: Reference Implementation in TypeScript / JavaScript
&lt;/h2&gt;

&lt;p&gt;Below is a zero-dependency implementation that converts a standard &lt;code&gt;Date&lt;/code&gt; object and geographic longitude into True Solar Time.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * Calculates the day of the year (1 - 366) in UTC.
 */&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getDayOfYear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&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="kr"&gt;number&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;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;UTC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&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="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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;UTC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;date&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="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUTCMonth&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUTCDate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&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;floor&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;86&lt;/span&gt;&lt;span class="nx"&gt;_400_000&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="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * Computes the Equation of Time (in minutes) using Spencer's (1971) formula.
 */&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getEquationOfTimeMinutes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dayOfYear&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;number&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;B&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PI&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dayOfYear&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="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;365.2422&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="mf"&gt;229.18&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.000075&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
      &lt;span class="mf"&gt;0.001868&lt;/span&gt; &lt;span class="o"&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;cos&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;B&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;
      &lt;span class="mf"&gt;0.032077&lt;/span&gt; &lt;span class="o"&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;sin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;B&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;
      &lt;span class="mf"&gt;0.014615&lt;/span&gt; &lt;span class="o"&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;cos&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;B&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;
      &lt;span class="mf"&gt;0.040849&lt;/span&gt; &lt;span class="o"&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;sin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;B&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="cm"&gt;/**
 * Converts civil clock time to True Solar Time (Apparent Solar Time).
 *
 * @param civilDate - Input timestamp (JavaScript Date instance)
 * @param localLongitude - Observer's longitude in degrees (East positive, West negative)
 * @param standardMeridian - Reference meridian of the civil time zone (default: 120.0 for UTC+8)
 * @returns Adjusted Date object representing True Solar Time
 */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;toTrueSolarTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;civilDate&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="nx"&gt;localLongitude&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;standardMeridian&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;120.0&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="c1"&gt;// 1. Longitude offset in minutes (4 minutes per degree)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;longitudeOffsetMin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;localLongitude&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;standardMeridian&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;4.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// 2. Equation of Time offset in minutes&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dayOfYear&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getDayOfYear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;civilDate&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;eotOffsetMin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getEquationOfTimeMinutes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dayOfYear&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// 3. Total correction in milliseconds&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;totalOffsetMs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;longitudeOffsetMin&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;eotOffsetMin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&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;civilDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getTime&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;totalOffsetMs&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// --- Example Usage ---&lt;/span&gt;
&lt;span class="c1"&gt;// Civil Time: 2026-02-11 12:00:00 (UTC+8) in Urumqi (87.62°E)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;civilTime&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-02-11T12:00:00+08:00&lt;/span&gt;&lt;span class="dl"&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;trueSolar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;toTrueSolarTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;civilTime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;87.62&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;120.0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Civil Clock Time (UTC+8):&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;civilTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;True Solar Time (Urumqi):&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;trueSolar&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="c1"&gt;// Output difference exceeds ~2 hours and 23 minutes!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Why This Matters for Boundary Edge Cases
&lt;/h2&gt;

&lt;p&gt;In traditional calendrical systems, each &lt;em&gt;Shichen&lt;/em&gt; spans 120 minutes. A combined longitude and &lt;code&gt;EoT&lt;/code&gt; offset in western regions (such as Tibet or Xinjiang, or even central cities like Xi'an and Chengdu) easily exceeds &lt;strong&gt;60 to 140 minutes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If a user's timestamp falls near the odd-hour boundaries (&lt;code&gt;01:00&lt;/code&gt;, &lt;code&gt;03:00&lt;/code&gt;, ..., &lt;code&gt;23:00&lt;/code&gt;), skipping the True Solar Time reduction will almost certainly assign the wrong Earthly Branch (&lt;em&gt;Dizhi&lt;/em&gt; / 地支) to the Hour Pillar—and if the timestamp crosses the &lt;code&gt;23:00&lt;/code&gt; (&lt;em&gt;Zi&lt;/em&gt; hour) threshold, it will corrupt the &lt;strong&gt;Day Pillar (日柱)&lt;/strong&gt; as well.&lt;/p&gt;

&lt;p&gt;By chaining &lt;strong&gt;True Solar Time reduction&lt;/strong&gt; for diurnal hour boundaries with &lt;a href="https://juto.com/jieqi/" rel="noopener noreferrer"&gt;exact solar longitude (&lt;code&gt;λ_sun&lt;/code&gt;) root-finding for 24 Solar Terms (二十四节气)&lt;/a&gt; in monthly transitions, a calendar engine achieves true astronomical fidelity regardless of where the observer is located on Earth.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>typescript</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
