mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Add the ability to get BambooHR away tomorrow
This commit is contained in:
parent
7072820967
commit
10142ebddc
@ -36,13 +36,17 @@ func (widget *Widget) Refresh() {
|
|||||||
url, _ := Config.String("wtf.bamboohr.url")
|
url, _ := Config.String("wtf.bamboohr.url")
|
||||||
|
|
||||||
client := NewClient(url)
|
client := NewClient(url)
|
||||||
items := client.Away("timeOff", wtf.Today(), wtf.Today())
|
todayItems := client.Away(
|
||||||
|
"timeOff",
|
||||||
|
wtf.Today().Format(wtf.DateFormat),
|
||||||
|
wtf.Today().Format(wtf.DateFormat),
|
||||||
|
)
|
||||||
|
|
||||||
widget.View.SetTitle(fmt.Sprintf(" 👽 Away (%d) ", len(items)))
|
widget.View.SetTitle(fmt.Sprintf(" 👽 Away (%d) ", len(todayItems)))
|
||||||
widget.RefreshedAt = time.Now()
|
widget.RefreshedAt = time.Now()
|
||||||
|
|
||||||
widget.View.Clear()
|
widget.View.Clear()
|
||||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(items))
|
fmt.Fprintf(widget.View, "%s", widget.contentFrom(todayItems))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
@ -72,9 +72,12 @@ func PrettyDate(dateStr string) string {
|
|||||||
return fmt.Sprint(newTime.Format("Jan 2, 2006"))
|
return fmt.Sprint(newTime.Format("Jan 2, 2006"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func Today() string {
|
func Today() time.Time {
|
||||||
localNow := time.Now().Local()
|
return time.Now().Local()
|
||||||
return localNow.Format("2006-01-02")
|
}
|
||||||
|
|
||||||
|
func Tomorrow() time.Time {
|
||||||
|
return Today().AddDate(0, 0, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToInts(slice []interface{}) []int {
|
func ToInts(slice []interface{}) []int {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user