1
0
mirror of https://github.com/taigrr/wtf synced 2026-03-30 08:15:15 -07:00

Allow custom date and time formats for clocks

This commit is contained in:
Dan Rabinowitz
2018-10-01 22:26:15 -06:00
parent eb7da5131e
commit e8ef4800f8
3 changed files with 14 additions and 11 deletions

View File

@@ -11,7 +11,9 @@ import (
type Widget struct {
wtf.TextWidget
clockColl ClockCollection
clockColl ClockCollection
dateFormat string
timeFormat string
}
func NewWidget(app *tview.Application) *Widget {
@@ -21,6 +23,9 @@ func NewWidget(app *tview.Application) *Widget {
widget.clockColl = widget.buildClockCollection(wtf.Config.UMap("wtf.mods.clocks.locations"))
widget.dateFormat = wtf.Config.UString("wtf.mods.clocks.dateFormat", wtf.SimpleDateFormat)
widget.timeFormat = wtf.Config.UString("wtf.mods.clocks.timeFormat", wtf.SimpleTimeFormat)
return &widget
}
@@ -28,7 +33,7 @@ func NewWidget(app *tview.Application) *Widget {
func (widget *Widget) Refresh() {
widget.UpdateRefreshedAt()
widget.display(widget.clockColl.Sorted())
widget.display(widget.clockColl.Sorted(), widget.dateFormat, widget.timeFormat)
}
/* -------------------- Unexported Functions -------------------- */