Documentation
¶
Overview ¶
Package date is pure calendar arithmetic for Go and TinyGo: weekday of a date, days in a month, leap years, month names, and the "YYYY-MM"/ "YYYY-MM-DD" key format used across the tinywasm ecosystem to identify a month or a day. No time zone, no wall clock, no JS interop — for that, use github.com/tinywasm/time. Every function here is a pure computation over (year, month, day) ints, so it runs identically in WASM and on the backend, and needs no build-tag split.
Index ¶
- func AddMonths(year, month, delta int) (int, int)
- func DateKey(year, month, day int) string
- func DaysInMonth(year, month int) int
- func IsLeapYear(year int) bool
- func MonthKey(year, month int) string
- func MonthName(month int) string
- func ParseMonthKey(s string) (year, month int)
- func Weekday(year, month, day int) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMonths ¶ added in v0.0.2
AddMonths adds delta months to (year, month), rolling the year over as needed — the only date arithmetic that depends on neither time zone nor the calendar (unlike day arithmetic, a month always has exactly 12 steps per year).
func DaysInMonth ¶ added in v0.0.2
DaysInMonth returns the number of days in month (1-12) for year.
func IsLeapYear ¶ added in v0.0.2
IsLeapYear reports whether year is a leap year.
func MonthName ¶ added in v0.0.2
MonthName returns month's Spanish name ("Enero".."Diciembre"), or "" if month is out of range. Switch, not a map — TinyGo.
func ParseMonthKey ¶ added in v0.0.2
ParseMonthKey reads "YYYY-MM" (or the "YYYY-MM-DD" form, ignoring the day); returns (0, 0) if s is not a valid month key.
Types ¶
This section is empty.