Skip to content

Dates

Date :: struct {...}
Locale :: struct {...}
calendar :: proc(value: Date, min := Date{}, max := Date{}, key := "") -> (Date, bool)
date_add_days :: proc(d: Date, n: int) -> Date
date_add_months :: proc(d: Date, n: int) -> Date
date_compare :: proc(a, b: Date) -> int
date_days_in_month :: proc(year, month: int) -> int
date_diff :: proc(a, b: Date) -> int
date_field :: proc(value: Date, min := Date{}, max := Date{}, placeholder := "", disabled := false, key := "") -> (Date, bool)
date_format :: proc(d: Date) -> string
date_is_leap :: proc(year: int) -> bool
date_parse :: proc(s: string) -> (Date, bool)
date_text :: proc(d: Date) -> string
date_valid :: proc(d: Date) -> bool
date_weekday :: proc(d: Date) -> int
locale_de :: proc() -> Locale
locale_en :: proc() -> Locale
today :: proc() -> Date
Date :: struct {
year, month, day: int, // month 1..12, day 1..31
}

A calendar day. The zero value means “no date”.

FieldTypeNotes
yearintmonth 1..12, day 1..31
monthintmonth 1..12, day 1..31
dayintmonth 1..12, day 1..31

Source: kiln/date.odin:20

Locale :: struct {
months: [12]string,
weekdays: [7]string, // short, Monday first: "Mo", "Tu", ...
first_weekday: int, // first column of the calendar: 0 = Monday, 6 = Sunday
date_pattern: string, // how `date_text` writes a date; YYYY, MM and DD are replaced
}

Names and conventions for dates, part of the theme’s metrics.

FieldTypeNotes
months[12]string
weekdays[7]stringshort, Monday first: “Mo”, “Tu”, …
first_weekdayintfirst column of the calendar: 0 = Monday, 6 = Sunday
date_patternstringhow date_text writes a date; YYYY, MM and DD are replaced

Source: kiln/date.odin:25

calendar :: proc(value: Date, min := Date{}, max := Date{}, key := "") -> (Date, bool)

A month view to pick a day from. Days outside min / max (zero = no limit) are drawn faint and cannot be picked. While the pointer is over it, the arrow keys move a focus, Page Up / Page Down switch the month and Enter picks the focused day.

ArgumentTypeDefault
valueDaterequired
minDateDate{}
maxDateDate{}
keystring""
ReturnsType
#0Date
#1bool

Source: kiln/date.odin:243

date_add_days :: proc(d: Date, n: int) -> Date
ArgumentTypeDefault
dDaterequired
nintrequired
ReturnsType
#0Date

Source: kiln/date.odin:100

date_add_months :: proc(d: Date, n: int) -> Date

Moves by whole months and clamps the day: 31 Jan + 1 month = 28 or 29 Feb.

ArgumentTypeDefault
dDaterequired
nintrequired
ReturnsType
#0Date

Source: kiln/date.odin:105

date_compare :: proc(a, b: Date) -> int

-1, 0 or 1.

ArgumentTypeDefault
aDaterequired
bDaterequired
ReturnsType
#0int

Source: kiln/date.odin:118

date_days_in_month :: proc(year, month: int) -> int
ArgumentTypeDefault
yearintrequired
monthintrequired
ReturnsType
#0int

Source: kiln/date.odin:84

date_diff :: proc(a, b: Date) -> int

Days from a to b (negative if b is earlier).

ArgumentTypeDefault
aDaterequired
bDaterequired
ReturnsType
#0int

Source: kiln/date.odin:113

date_field :: proc(
value: Date,
min := Date{},
max := Date{},
placeholder := "",
disabled := false,
key := "",
) -> (Date, bool)

A field showing the date (or the placeholder); a click opens a calendar below it, or above when there is no room below. Picking a day closes it.

if d, ok := kiln.date_field(m.birthday, max = kiln.today()); ok {append(out, Set_Birthday{d})}
ArgumentTypeDefault
valueDaterequired
minDateDate{}
maxDateDate{}
placeholderstring""
disabledboolfalse
keystring""
ReturnsType
#0Date
#1bool

Source: kiln/date.odin:260

date_format :: proc(d: Date) -> string

“2026-10-26”, in the temp allocator.

ArgumentTypeDefault
dDaterequired
ReturnsType
#0string

Source: kiln/date.odin:138

date_is_leap :: proc(year: int) -> bool
ArgumentTypeDefault
yearintrequired
ReturnsType
#0bool

Source: kiln/date.odin:80

date_parse :: proc(s: string) -> (Date, bool)

Parses “2026-10-26”.

ArgumentTypeDefault
sstringrequired
ReturnsType
#0Date
#1bool

Source: kiln/date.odin:126

date_text :: proc(d: Date) -> string

The date written with the locale’s date_pattern (“26.10.2026”), in the temp allocator.

ArgumentTypeDefault
dDaterequired
ReturnsType
#0string

Source: kiln/date.odin:143

date_valid :: proc(d: Date) -> bool
ArgumentTypeDefault
dDaterequired
ReturnsType
#0bool

Source: kiln/date.odin:91

date_weekday :: proc(d: Date) -> int

Day of the week, 0 = Monday … 6 = Sunday.

ArgumentTypeDefault
dDaterequired
ReturnsType
#0int

Source: kiln/date.odin:96

locale_de :: proc() -> Locale
ReturnsType
#0Locale

Source: kiln/date.odin:54

locale_en :: proc() -> Locale
ReturnsType
#0Locale

Source: kiln/date.odin:32

today :: proc() -> Date

Today in the local time zone.

ReturnsType
#0Date

Source: kiln/date.odin:158