Skip to content

Improve moon-phase rendering: smooth offsets, finer Chinese labels, and live updates#10

Merged
Heersin merged 1 commit into
mainfrom
codex/fix-moon-status-algorithm
Feb 28, 2026
Merged

Improve moon-phase rendering: smooth offsets, finer Chinese labels, and live updates#10
Heersin merged 1 commit into
mainfrom
codex/fix-moon-status-algorithm

Conversation

@Heersin
Copy link
Copy Markdown
Owner

@Heersin Heersin commented Feb 28, 2026

Motivation

  • Make moon visualization reflect the lunar cycle more smoothly and provide more granular Chinese phase labels for better UX.
  • Ensure displayed Gregorian and Chinese lunar datetimes (including traditional earthly-branch hours) stay up to date.
  • Replace one-off computation with a periodic renderer so the UI updates continuously without reloads.

Description

  • Reworked assets/js/moon-phase.js to move DOM lookups, introduce a render function, and drive updates via setInterval calling render(Date.now()) every second.
  • Replaced the coarse four-state phase logic with a finer-grained getMoonPhaseLabel mapping and a smooth --phase-offset calculation that interpolates across the synodic month for gradual light/dark transitions.
  • Restored and localized date/Chinese lunar formatting using Intl.DateTimeFormat, and recompute the traditional earthlyBranches hour label each render.
  • Preserved guards for absent DOM elements and update text content, aria-label, and CSS variable from the render loop.

Testing

  • No automated tests were run for this change.

Codex Task

@Heersin Heersin merged commit fe2969c into main Feb 28, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant