mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-10-05 04:13:59 +00:00
/amlich converts duong lich to am lich (defaults to today, Asia/Saigon); /duonglich converts am lich to duong lich with a nhuan flag for leap months. Dates accept d, d/m, or d/m/yyyy - missing parts fill from today in the input's calendar. Conversion is a dependency-free port of Ho Ngoc Duc's algorithm at UTC+7, with rejection of impossible lunar inputs, anchored by known Tet/leap-month dates and a 1950-2050 round-trip test.
21 lines
628 B
Go
21 lines
628 B
Go
// Package amlich converts dates between dương lịch (the Gregorian calendar)
|
|
// and the Vietnamese âm lịch (lunisolar calendar): /amlich and /duonglich.
|
|
// Conversions are pure calendar math computed at UTC+7 — the offset the
|
|
// Vietnamese calendar is defined against.
|
|
package amlich
|
|
|
|
import (
|
|
"github.com/tiennm99/miti99bot/internal/modules"
|
|
)
|
|
|
|
// New is the module Factory. The module is stateless — pure calendar math with
|
|
// no store access — so Deps is unused.
|
|
func New(modules.Deps) modules.Module {
|
|
return modules.Module{
|
|
Commands: []modules.Command{
|
|
amlichCommand(),
|
|
duonglichCommand(),
|
|
},
|
|
}
|
|
}
|