"use client" import { useState } from "react" import { Card } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Moon } from "lucide-react" export function CalendarTranslator() { const [gregorianDate, setGregorianDate] = useState("") const [lunarDate, setLunarDate] = useState<{ moon: number day: number moonName: string dayOfWeek: string } | null>(null) const moonNames = [ "Magnetic Moon", "Lunar Moon", "Electric Moon", "Self-Existing Moon", "Overtone Moon", "Rhythmic Moon", "Resonant Moon", "Galactic Moon", "Solar Moon", "Planetary Moon", "Spectral Moon", "Crystal Moon", "Cosmic Moon", ] const dayNames = ["Dali", "Seli", "Gamma", "Kali", "Alpha", "Limi", "Silio"] const convertToLunar = (dateString: string) => { const date = new Date(dateString) const year = date.getFullYear() // July 26 is day 1 of the 13-moon calendar const startOfYear = new Date(year, 6, 26) // July 26 let dayOfYear = Math.floor((date.getTime() - startOfYear.getTime()) / (1000 * 60 * 60 * 24)) + 1 // If date is before July 26, use previous calendar year if (dayOfYear < 1) { const prevStartOfYear = new Date(year - 1, 6, 26) dayOfYear = Math.floor((date.getTime() - prevStartOfYear.getTime()) / (1000 * 60 * 60 * 24)) + 1 } // Handle Day Out of Time (July 25) if (dayOfYear > 364) { setLunarDate({ moon: 0, day: 0, moonName: "Day Out of Time", dayOfWeek: "Out of Time", }) return } // Calculate moon and day const moon = Math.floor((dayOfYear - 1) / 28) + 1 const day = ((dayOfYear - 1) % 28) + 1 const dayOfWeek = dayNames[(day - 1) % 7] setLunarDate({ moon, day, moonName: moonNames[moon - 1], dayOfWeek, }) } const handleConvert = () => { if (gregorianDate) { convertToLunar(gregorianDate) } } const handleTodayClick = () => { const today = new Date().toISOString().split("T")[0] setGregorianDate(today) convertToLunar(today) } return (

Calendar Translator

Convert any Gregorian calendar date to the 13-moon lunar calendar.

setGregorianDate(e.target.value)} className="flex-1" />
{lunarDate && (

13-Moon Date

{lunarDate.moonName === "Day Out of Time" ? (

Day Out of Time

A day for forgiveness, celebration, and preparation for the new year. This day (July 25) exists outside the normal calendar cycle.

) : (

Moon

{lunarDate.moon}

{lunarDate.moonName}

Day

{lunarDate.day}

{lunarDate.dayOfWeek}

)}

Note: The 13-moon calendar begins on July 26 (Gregorian) and consists of 13 perfect moons of 28 days each, plus one "Day Out of Time" on July 25.

)}

The 13-moon calendar synchronizes with actual lunar cycles and creates a fractal, harmonic relationship with natural time. Each moon has 28 days (4 weeks of 7 days), mirroring the average menstrual cycle and the moon's orbit around Earth.

) }