Merge pull request #267 from xendke/calendar-start-day

Optionally start calendar weeks on Sunday
This commit is contained in:
Svilen Markov 2024-11-26 17:02:26 +00:00 committed by GitHub
commit 4bd4921131
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 25 additions and 11 deletions

View file

@ -10,8 +10,9 @@ import (
)
type Calendar struct {
widgetBase `yaml:",inline"`
Calendar *feed.Calendar
widgetBase `yaml:",inline"`
Calendar *feed.Calendar
StartSunday bool `yaml:"start-sunday"`
}
func (widget *Calendar) Initialize() error {
@ -21,7 +22,7 @@ func (widget *Calendar) Initialize() error {
}
func (widget *Calendar) Update(ctx context.Context) {
widget.Calendar = feed.NewCalendar(time.Now())
widget.Calendar = feed.NewCalendar(time.Now(), widget.StartSunday)
widget.withError(nil).scheduleNextUpdate()
}