zenity/date.go

21 lines
582 B
Go
Raw Normal View History

2021-04-11 22:02:21 -04:00
package zenity
2022-05-11 12:49:15 -04:00
import "time"
2021-04-11 22:02:21 -04:00
// Calendar displays the calendar dialog.
//
// Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton,
2022-06-02 07:24:24 -04:00
// WindowIcon, Attach, Modal, DefaultDate.
2022-03-28 15:22:39 -04:00
//
2022-05-02 06:22:53 -04:00
// May return: ErrCanceled, ErrExtraButton.
2021-04-11 22:02:21 -04:00
func Calendar(text string, options ...Option) (time.Time, error) {
return calendar(text, applyOptions(options))
}
// DefaultDate returns an Option to set the date.
func DefaultDate(year int, month time.Month, day int) Option {
return funcOption(func(o *options) {
2022-12-14 19:26:34 -05:00
o.time = ptr(time.Date(year, month, day, 0, 0, 0, 0, time.Local))
2021-04-11 22:02:21 -04:00
})
}