Fixed TimeZone sorting issue
Also added some more colors
This commit is contained in:
parent
c4e55cc52f
commit
b306787978
@ -173,7 +173,7 @@ func drawCalList(g *gocui.Gui, v *gocui.View) error {
|
||||
} else {
|
||||
calSumTxt += " "
|
||||
}
|
||||
calSumTxt += "] " + list[i].Summary
|
||||
calSumTxt += "] " + list[i].Summary + " " + list[i].BackgroundColor
|
||||
spc := strings.Repeat(" ", width-len(calSumTxt)-2)
|
||||
fmt.Fprintln(v, calSumTxt+spc)
|
||||
}
|
||||
|
8
main.go
8
main.go
@ -442,12 +442,16 @@ func CalColToAnsi(col calendar.ColorDefinition) *color.Color {
|
||||
//colWhite := 7
|
||||
|
||||
var hexToAnsi = func(hex string) (int, error) {
|
||||
switch hex {
|
||||
switch strings.ToLower(hex) {
|
||||
case "#a47ae2", "#9a9cff", "#4986e7":
|
||||
return colBlue, nil
|
||||
case "#7bd148":
|
||||
return colGreen, nil
|
||||
case "#9fc6e7", "#9fe1e7":
|
||||
return colCyan, nil
|
||||
case "#f83a22", "#ac725e":
|
||||
return colRed, nil
|
||||
case "#fad165":
|
||||
case "#fad165", "#ff7537", "#e6c800":
|
||||
return colYellow, nil
|
||||
}
|
||||
return 0, errors.New("Not found")
|
||||
|
@ -81,6 +81,7 @@ func (a *Account) GetTodaysActiveEvents() []Event {
|
||||
}
|
||||
}
|
||||
}
|
||||
sort.Sort(ByStartTime(ret))
|
||||
for i := range ret {
|
||||
ret[i].InstanceId = startIdx
|
||||
startIdx++
|
||||
|
@ -87,7 +87,7 @@ func (e *Event) GetStartTimeString() string {
|
||||
|
||||
func (e *Event) GetStartTime() time.Time {
|
||||
tm, _ := time.Parse(time.RFC3339, e.Start.DateTime)
|
||||
return tm
|
||||
return tm.Local()
|
||||
}
|
||||
|
||||
func (e *Event) GetEndTimeString() string {
|
||||
@ -100,7 +100,7 @@ func (e *Event) GetEndTimeString() string {
|
||||
|
||||
func (e *Event) GetEndTime() time.Time {
|
||||
tm, _ := time.Parse(time.RFC3339, e.End.DateTime)
|
||||
return tm
|
||||
return tm.Local()
|
||||
}
|
||||
|
||||
func GoogleEventToLocalWithId(e *calendar.Event, cId string) *Event {
|
||||
@ -290,4 +290,8 @@ type ByStartTime []Event
|
||||
|
||||
func (a ByStartTime) Len() int { return len(a) }
|
||||
func (a ByStartTime) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a ByStartTime) Less(i, j int) bool { return a[i].Start.DateTime < a[j].Start.DateTime }
|
||||
func (a ByStartTime) Less(i, j int) bool {
|
||||
st1, _ := time.Parse(time.RFC3339, a[i].Start.DateTime)
|
||||
st2, _ := time.Parse(time.RFC3339, a[j].Start.DateTime)
|
||||
return st2.After(st1)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user