zenity/date.go

24 lines
571 B
Go
Raw Permalink Normal View History

2021-04-11 22:02:21 -04:00
package zenity
import (
"time"
)
// Calendar displays the calendar dialog.
//
// Valid options: Title, Width, Height, OKLabel, CancelLabel, ExtraButton,
2022-03-28 15:22:39 -04:00
// Icon, DefaultDate.
//
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-04-07 07:50:20 -04:00
t := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
2022-03-28 22:05:46 -04:00
o.time = &t
2021-04-11 22:02:21 -04:00
})
}