1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/bamboohr/item.go
2018-06-10 00:16:40 +03:00

43 lines
834 B
Go

package bamboohr
import (
"fmt"
//"time"
"github.com/andrewzolotukhin/wtf/wtf"
)
type Item struct {
Employee Employee `xml:"employee"`
End string `xml:"end"`
Holiday string `xml:"holiday"`
Start string `xml:"start"`
Type string `xml:"type,attr"`
}
func (item *Item) String() string {
return fmt.Sprintf("Item: %s, %s, %s, %s", item.Type, item.Employee.Name, item.Start, item.End)
}
/* -------------------- Exported Functions -------------------- */
func (item *Item) IsOneDay() bool {
return item.Start == item.End
}
func (item *Item) Name() string {
if (item.Employee != Employee{}) {
return item.Employee.Name
}
return item.Holiday
}
func (item *Item) PrettyStart() string {
return wtf.PrettyDate(item.Start)
}
func (item *Item) PrettyEnd() string {
return wtf.PrettyDate(item.End)
}