zenity/date_darwin.go
2024-09-06 11:16:18 -04:00

37 lines
686 B
Go

package zenity
import (
"time"
"git.bigun.dev/evan/zenity/internal/zenutil"
)
func calendar(text string, opts options) (t time.Time, err error) {
var data zenutil.Date
data.OK, data.Cancel, data.Extra = getAlertButtons(opts)
data.Format, err = zenutil.DateUTS35()
if err != nil {
return
}
if opts.time != nil {
data.Date = ptr(opts.time.Unix())
}
if opts.title != nil {
data.Text = *opts.title
data.Info = text
} else {
data.Text = text
}
if i, ok := opts.windowIcon.(string); ok {
data.WindowIcon = i
}
out, err := zenutil.Run(opts.ctx, "date", data)
str, err := strResult(opts, out, err)
if err != nil {
return
}
return zenutil.DateParse(str)
}