A WebAssembly application built with Rust that displays both the current time and its corresponding Chinese Lunar Calendar date.
- Real-time display of current time
- Chinese Lunar Calendar conversion
- Chinese Zodiac year display
- Modern and responsive UI
- Automatic updates every second
- Rust and Cargo (https://rustup.rs/)
- wasm-pack (install with
cargo install wasm-pack
) - A local web server (e.g.,
python3 -m http.server
)
- Build the WebAssembly module:
wasm-pack build --target web
- Start a local web server:
python3 -m http.server 8080
- Open your web browser and navigate to
http://localhost:8080
src/lib.rs
- Rust source code for the WebAssembly module, including lunar calendar conversionindex.html
- Web interface with real-time updatesCargo.toml
- Rust project configuration and dependencies
wasm-bindgen
- WebAssembly bindingschrono
- Date and time handlingchinese-lunisolar-calendar
- Chinese lunar calendar calculationsserde
andserde_json
- JSON serialization
The application shows:
- Current time in ISO format
- Chinese Lunar Calendar date
- Chinese Zodiac year
Example output:
公历时间: 2024-12-12T17:34:21+08:00
农历二〇二四年十一月初一 龙年
- The lunar calendar conversion is handled by the
chinese-lunisolar-calendar
crate - Time is automatically updated every second
- The interface is fully responsive and works on both desktop and mobile browsers