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:
@@ -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 -------------------- */
|
||||
|
||||
Reference in New Issue
Block a user